diff --git a/Context/FoodeeDbContext.cs b/Context/FoodeeDbContext.cs index 7e0dbc5..0b64ad2 100644 --- a/Context/FoodeeDbContext.cs +++ b/Context/FoodeeDbContext.cs @@ -12,6 +12,7 @@ public class FoodeeDbContext : DbContext public FoodeeDbContext(DbContextOptions options) : base(options) { } + public DbSet Carts { get; set; } public DbSet Menus { get; set; } public DbSet MenuItems { get; set; } public DbSet MenuMenuItems { get; set; } @@ -68,7 +69,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) base.OnModelCreating(modelBuilder); - modelBuilder.Entity().HasMany(m => m.MenuItems) + modelBuilder.Entity().HasMany(m => m.MenuMenuItems) .WithOne(m => m.Menu) .HasForeignKey(m => m.MenuId).OnDelete(DeleteBehavior.Restrict); diff --git a/Controllers/AdminController.cs b/Controllers/AdminController.cs index 9045845..884f3a6 100644 --- a/Controllers/AdminController.cs +++ b/Controllers/AdminController.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Mvc; +using FOODEE.Interface; +using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; @@ -8,9 +9,16 @@ namespace FOODEE.Controllers { public class AdminController : Controller { + private readonly IMenuItemService _menuitemService; + + public AdminController(IMenuItemService menuitemService) + { + _menuitemService = menuitemService; + } + public IActionResult Index() { - return View(); + return View(_menuitemService.GetAll()); } } } diff --git a/Controllers/CartController.cs b/Controllers/CartController.cs new file mode 100644 index 0000000..fac4bdc --- /dev/null +++ b/Controllers/CartController.cs @@ -0,0 +1,26 @@ +using FOODEE.Interface; +using FOODEE.Models; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Claims; +using System.Threading.Tasks; + +namespace FOODEE.Controllers +{ + public class CartController : Controller + { + private readonly ICartService _cartService; + + public CartController(ICartService cartService) + { + _cartService = cartService; + } + public IActionResult Index() + { + return View(); + } + } +} diff --git a/Controllers/CustomerController.cs b/Controllers/CustomerController.cs index 402ac30..ef5d7c0 100644 --- a/Controllers/CustomerController.cs +++ b/Controllers/CustomerController.cs @@ -1,16 +1,105 @@ -using Microsoft.AspNetCore.Mvc; +using FOODEE.DTO; +using FOODEE.Interface; +using FOODEE.Models; +using FOODEE.Models.ViewModel; +using Microsoft.AspNetCore.Authentication; +using Microsoft.AspNetCore.Authentication.Cookies; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; +using System.Security.Claims; using System.Threading.Tasks; namespace FOODEE.Controllers { public class CustomerController : Controller { + private readonly IMenuItemService _menuitemService; + private readonly IMenuService _menuService; + private readonly IMenuMenuItemService _menumenuitemService; + public IUserService _userService; + public IUserRoleService _userRoleService; + public IRoleService _roleService; + + public CustomerController(IMenuItemService menuitemService, IMenuService menuService, IMenuMenuItemService menumenuitemService, IUserService userService, IUserRoleService userRoleService, IRoleService roleService) + { + _menuitemService = menuitemService; + _menuService = menuService; + _menumenuitemService = menumenuitemService; + _userService = userService; + _userRoleService = userRoleService; + _roleService = roleService; + } + public IActionResult Index() { + return View(_menuService.GetAll()); + } + [HttpGet] + public IActionResult GetByMenu(int id) + { + + var menumenuItem = _menumenuitemService.GetByMenu(id); + + ViewBag.Menu = _menuService.FindById(id).Name; + + List MenuItems = new List(); + foreach (var item in menumenuItem) + { + var menuitem = _menuitemService.FindById(item.MenuItemId); + MenuItems.Add(menuitem); + } + + return View(MenuItems); + } + + [HttpGet] + [AllowAnonymous] + public IActionResult Login() + { + return View(); } - } + [HttpPost] + [AllowAnonymous] + public async Task Login(LoginViewModel vm, bool isCheckout = false) + { + CreateUserDto createuserDto = new CreateUserDto + { + Email = vm.Email, + Password = vm.Password, + }; + User user = _userService.LoginUser(createuserDto); + if (user == null) + { + if (isCheckout) + { + return RedirectToAction("Checkout","Order"); + } + return View(); + } + else + { + var claims = new List + { + new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()), + new Claim(ClaimTypes.Email, user.Email), + new Claim(ClaimTypes.Role, "Customer") + }; + + var identity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme); + + var principal = new ClaimsPrincipal(identity); + + var props = new AuthenticationProperties(); + + await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal, props); + return isCheckout ? RedirectToAction("Checkout", "Order") : RedirectToAction("Index", "Home"); + } + } + } } + + diff --git a/Controllers/HomeController.cs b/Controllers/HomeController.cs index b540a73..42f10c3 100644 --- a/Controllers/HomeController.cs +++ b/Controllers/HomeController.cs @@ -22,8 +22,10 @@ public HomeController(IMenuItemService menuitemService, ILogger } public IActionResult Index() { - var menuitems = _menuitemService.GetAll(); - return View(menuitems); + //var menuitems = _menuitemService.GetAll(); + //return View(menuitems); + + return RedirectToAction("IndexAnonymous","MenuItem"); } public IActionResult Privacy() { diff --git a/Controllers/MenuController.cs b/Controllers/MenuController.cs index 4aeadf2..eb6c3c8 100644 --- a/Controllers/MenuController.cs +++ b/Controllers/MenuController.cs @@ -1,29 +1,64 @@ -using FOODEE.Interface; +using FOODEE.DTO; +using FOODEE.Interface; using FOODEE.Models; +using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; +using System.IO; using System.Linq; +using System.Security.Claims; using System.Threading.Tasks; +using static FOODEE.Models.ViewModel.MenuVM; namespace FOODEE.Controllers { public class MenuController : Controller { private readonly IMenuService _menuService; - public MenuController(IMenuService menuService) + private readonly IMenuMenuItemService _menumenuitemService; + private readonly IMenuItemService _menuitemService; + private readonly IWebHostEnvironment _webHostEnvironment; + public MenuController(IMenuService menuService,IMenuMenuItemService menumenuitemService, IMenuItemService menuitemService, IWebHostEnvironment webHostEnvironment) { _menuService = menuService; + _menumenuitemService = menumenuitemService; + _menuitemService = menuitemService; + _webHostEnvironment = webHostEnvironment; + } [HttpGet] public IActionResult Index() { - var model = _menuService.GetAll(); - return View(model); + IEnumerable menus = _menuService.GetAllMenus(); + + return View(menus); + } + [HttpGet] + public IActionResult IndexAdmin() + { + IEnumerable menus = _menuService.GetAllMenus(); + + return View(menus); } + [HttpGet] + public IActionResult GetByMenu(int id) + { + var menumenuItem = _menumenuitemService.GetByMenu(id); + ViewBag.Menu = _menuService.FindById(id).Name; + + List MenuItems = new List(); + foreach (var item in menumenuItem) + { + var menuitem = _menuitemService.FindById(item.MenuItemId); + MenuItems.Add(menuitem); + } + + return View(MenuItems); + } [HttpGet] public IActionResult Details(int? id) { @@ -41,21 +76,38 @@ public IActionResult Details(int? id) return View(menu); } - [HttpGet] public IActionResult Add() { return View(); } [HttpPost] - public IActionResult Add(Menu menu) + [ValidateAntiForgeryToken] + public IActionResult Add(CreateMenuViewModel createmenuViewmodel) { + var menuDto = new MenuDto(); if (ModelState.IsValid) { - _menuService.Add(menu); + if (createmenuViewmodel.Image.FileName != null) + { + var file = createmenuViewmodel.Image; + string imageDirectory = Path.Combine(_webHostEnvironment.WebRootPath, "Image"); + Directory.CreateDirectory(imageDirectory); + string contentType = file.ContentType.Split('/')[1]; + string fileName = $"{Guid.NewGuid()}.{contentType}"; + string fullPath = Path.Combine(imageDirectory, fileName); + menuDto.Image = fileName; + using (var fileStream = new FileStream(fullPath, FileMode.Create)) + { + file.CopyTo(fileStream); + } + } } - return RedirectToAction(("Index")); - //return View(); + menuDto.Name = createmenuViewmodel.Name; + menuDto.Description = createmenuViewmodel.Description; + menuDto.MenuItems = createmenuViewmodel.MenuItems; + _menuService.Add(menuDto); + return View(createmenuViewmodel); } [HttpGet] @@ -128,7 +180,6 @@ public IActionResult Delete(int? id) [ValidateAntiForgeryToken] public IActionResult DeleteConfirmed(int id) { - _menuService.Delete(id); return RedirectToAction(nameof(Index)); } diff --git a/Controllers/MenuItemController.cs b/Controllers/MenuItemController.cs index 771138d..186c655 100644 --- a/Controllers/MenuItemController.cs +++ b/Controllers/MenuItemController.cs @@ -32,6 +32,17 @@ public IActionResult Index() { return View(_menuitemService.GetAll()); } + public IActionResult IndexAdmin() + { + IEnumerable menuitems = _menuitemService.GetAll(); + + return View(menuitems); + } + + public IActionResult IndexAnonymous() + { + return View(_menuitemService.GetAll()); + } [AllowAnonymous] public IActionResult Details(int? id) diff --git a/Controllers/OrderController.cs b/Controllers/OrderController.cs index ce2be9c..b4dc0e6 100644 --- a/Controllers/OrderController.cs +++ b/Controllers/OrderController.cs @@ -13,9 +13,11 @@ namespace FOODEE.Controllers public class OrderController : Controller { private readonly IOrderService _orderService; - public OrderController(IOrderService orderService) + private readonly IUserService _userService; + public OrderController(IOrderService orderService, IUserService userService) { _orderService = orderService; + _userService = userService; } public IActionResult Index() { @@ -38,7 +40,7 @@ public IActionResult Details(int? id) } [HttpGet] - public IActionResult Create() + public IActionResult Add() { return View(); } @@ -49,6 +51,7 @@ public IActionResult Add(Order order) { if (ModelState.IsValid) { + _orderService.Add(order); } @@ -119,24 +122,24 @@ public IActionResult Confirmation() return View(); } - + [Authorize] public IActionResult CheckOut() { - if(User.Identity.IsAuthenticated) - { - return View(); - } - - return RedirectToAction("Login","User"); - } - - - [HttpPost] - public IActionResult Menu(IEnumerable orders, string deliveryAddress) - { - var customerId = Convert.ToInt32(User.FindFirst(ClaimTypes.NameIdentifier).Value); - var response = _orderService.Menu(customerId, orders, deliveryAddress); - return View("Confirmation", response); + int userId = int.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier)); + User userlogin = _userService.FindById(userId); + ViewBag.UserName = $"{userlogin.FirstName} .{userlogin.LastName[0]}"; + ViewBag.Address = userlogin.Address; + ViewBag.Email = userlogin.Email; + ViewBag.PhoneNumber = userlogin.PhoneNumber; + return View(); } + + //[HttpPost] + //public IActionResult Menu(IEnumerable orders, string deliveryAddress) + //{ + // var customerId = Convert.ToInt32(User.FindFirst(ClaimTypes.NameIdentifier).Value); + // var response = _orderService.Menu(customerId, orders, deliveryAddress); + // return View("Confirmation", response); + //} } } diff --git a/Controllers/OrderItemController.cs b/Controllers/OrderItemController.cs index 6f4d559..8f2a337 100644 --- a/Controllers/OrderItemController.cs +++ b/Controllers/OrderItemController.cs @@ -37,7 +37,7 @@ public IActionResult Details(int? id) } [HttpGet] - public IActionResult Create() + public IActionResult Add() { return View(); } diff --git a/Controllers/SuperAdmin.cs b/Controllers/SuperAdmin.cs deleted file mode 100644 index 696822b..0000000 --- a/Controllers/SuperAdmin.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace FOODEE.Controllers -{ - public class SuperAdmin : Controller - { - public IActionResult Index() - { - return View(); - } - } -} diff --git a/Controllers/SuperAdminController.cs b/Controllers/SuperAdminController.cs new file mode 100644 index 0000000..246723e --- /dev/null +++ b/Controllers/SuperAdminController.cs @@ -0,0 +1,51 @@ +using FOODEE.Interface; +using FOODEE.Models; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace FOODEE.Controllers +{ + public class SuperAdminController : Controller + { + private readonly IMenuService _menuService; + + public SuperAdminController(IMenuService menuService) + { + _menuService = menuService; + } + + public IActionResult Index() + { + IEnumerable menus = _menuService.GetAllMenus(); + + return View(menus); + } + public IActionResult Delete(int? id) + { + if (id == null) + { + return NotFound(); + } + + var menu = _menuService.FindById(id.Value); + if (menu == null) + { + return NotFound(); + } + + return View(menu); + } + + + [HttpPost, ActionName("Delete")] + [ValidateAntiForgeryToken] + public IActionResult DeleteConfirmed(int id) + { + _menuService.Delete(id); + return RedirectToAction(nameof(Index)); + } + } +} diff --git a/Controllers/UserController.cs b/Controllers/UserController.cs index 4be6a36..11b79c8 100644 --- a/Controllers/UserController.cs +++ b/Controllers/UserController.cs @@ -55,22 +55,16 @@ public IActionResult Register(CreateUserViewModel model) }; _userService.RegisterUser(createuserDto); - return RedirectToAction("User","Login"); + return RedirectToAction("Login"); } [HttpGet] public IActionResult Login() { - if (HttpContext.User.Identity.IsAuthenticated) - { - var routeName = HttpContext.Request.Path; - return RedirectToAction(routeName); - } - return View(); } [HttpPost] - public async Task Login(LoginViewModel vm) + public async Task Login(LoginViewModel vm, string returnUrl) { CreateUserDto createuserDto = new CreateUserDto { @@ -129,10 +123,7 @@ public async Task Login(LoginViewModel vm) new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()), new Claim(ClaimTypes.Email, user.Email), new Claim(ClaimTypes.Role, "Customer") - - }; - var identity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme); var principal = new ClaimsPrincipal(identity); @@ -140,11 +131,17 @@ public async Task Login(LoginViewModel vm) var props = new AuthenticationProperties(); await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal, props); - //return RedirectToAction("Index", "Home"); + + } + + if (returnUrl != null) + { + return Redirect(returnUrl); } - if (role == "SuperAdmin") + + else if (role == "SuperAdmin") { - return RedirectToAction("Index", "SuperAdmin"); + return RedirectToAction("IndexAdmin", "Menu"); } else if (role == "Admin") { @@ -162,6 +159,10 @@ public async Task Login(LoginViewModel vm) } public async Task Logout() { + int userId = int.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier)); + User userlogin = _userService.FindById(userId); + ViewBag.UserName = $"{userlogin.FirstName} .{userlogin.LastName[0]}"; + await HttpContext.SignOutAsync(); return RedirectToAction("Login"); } diff --git a/DTO/MenuDto.cs b/DTO/MenuDto.cs new file mode 100644 index 0000000..21e466a --- /dev/null +++ b/DTO/MenuDto.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace FOODEE.DTO +{ + public class MenuDto + { + public int Id { get; set; } + public string Name { get; set; } + public int Quantity { get; set; } + public string Description { get; set; } + public decimal Price { get; set; } + public string Image { get; set; } + public int MenuId { get; set; } + public string[] MenuItems { get; set; } + } +} diff --git a/DTO/OrderDto.cs b/DTO/OrderDto.cs new file mode 100644 index 0000000..370f08e --- /dev/null +++ b/DTO/OrderDto.cs @@ -0,0 +1,18 @@ +using FOODEE.Enum; +using FOODEE.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace FOODEE.DTO +{ + public class OrderDto + { + public int userId { get; set; } + public string DeliveryAddress { get; set; } + public decimal TotalPrice { get; set; } + public User User { get; set; } + public List OrderItems { get; set; } = new List(); + } +} diff --git a/FOODEE.csproj b/FOODEE.csproj index 3b38cc9..f270f2b 100644 --- a/FOODEE.csproj +++ b/FOODEE.csproj @@ -21,8 +21,4 @@ - - - - diff --git a/Interface/ICartRepository.cs b/Interface/ICartRepository.cs new file mode 100644 index 0000000..e8c0f9f --- /dev/null +++ b/Interface/ICartRepository.cs @@ -0,0 +1,18 @@ +using FOODEE.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace FOODEE.Interface +{ + public interface ICartRepository + { + public IEnumerable GetCartsByUserId(int id); + public Cart Add(Cart cart); + public Cart Update(Cart cart); + public Cart FindById(int id); + public void Delete(int id); + public List GetAll(); + } +} diff --git a/Interface/ICartService.cs b/Interface/ICartService.cs new file mode 100644 index 0000000..2bd3b36 --- /dev/null +++ b/Interface/ICartService.cs @@ -0,0 +1,18 @@ +using FOODEE.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace FOODEE.Interface +{ + public interface ICartService + { + public Cart FindById(int id); + public Cart Add(Cart cart); + public Cart Update(Cart cart); + public void Delete(int id); + public List GetAll(); + public IEnumerable GetCartsByUserId(int id); + } +} diff --git a/Interface/IMenuMenuItemRepository.cs b/Interface/IMenuMenuItemRepository.cs index 7dde517..8b1d031 100644 --- a/Interface/IMenuMenuItemRepository.cs +++ b/Interface/IMenuMenuItemRepository.cs @@ -12,5 +12,7 @@ public interface IMenuMenuItemRepository public MenuMenuItem Update(MenuMenuItem menumenuitem); public MenuMenuItem FindById(int id); public void Delete(int id); + public List GetByMenu(int menuId); + public List GetMenuByMenuItemId(int menuitemId); } } diff --git a/Interface/IMenuMenuItemService.cs b/Interface/IMenuMenuItemService.cs index e582df6..2a61698 100644 --- a/Interface/IMenuMenuItemService.cs +++ b/Interface/IMenuMenuItemService.cs @@ -12,5 +12,7 @@ public interface IMenuMenuItemService public MenuMenuItem Update(MenuMenuItem menumenuitem); public void Delete(int id); public MenuMenuItem FindById(int id); + public IEnumerable GetMenuByMenuItemId(int menuitemId); + public IEnumerable GetByMenu(int menuId); } } diff --git a/Interface/IMenuRepository.cs b/Interface/IMenuRepository.cs index 7781c20..33628b8 100644 --- a/Interface/IMenuRepository.cs +++ b/Interface/IMenuRepository.cs @@ -1,4 +1,5 @@ -using FOODEE.Models; +using FOODEE.DTO; +using FOODEE.Models; using System; using System.Collections.Generic; using System.Linq; @@ -13,6 +14,7 @@ public interface IMenuRepository public void Delete(int id); public Menu Update(Menu menu); public List GetAll(); + public IEnumerable GetAllMenus(); public bool Exists(int id); } diff --git a/Interface/IMenuService.cs b/Interface/IMenuService.cs index 7d16538..d815745 100644 --- a/Interface/IMenuService.cs +++ b/Interface/IMenuService.cs @@ -1,4 +1,5 @@ -using FOODEE.Models; +using FOODEE.DTO; +using FOODEE.Models; using System; using System.Collections.Generic; using System.Linq; @@ -8,14 +9,11 @@ namespace FOODEE.Interface { public interface IMenuService { - public Menu Add(Menu menu); - public Menu Update(Menu menu); - public void Delete(int id); - + public IEnumerable GetAllMenus(); public List GetAll(); - + public Menu Add(MenuDto menuDto); public bool Exists(int id); public Menu FindById(int id); } diff --git a/Interface/IOrderService.cs b/Interface/IOrderService.cs index 1edcf52..dff3fde 100644 --- a/Interface/IOrderService.cs +++ b/Interface/IOrderService.cs @@ -14,6 +14,6 @@ public interface IOrderService public List GetAll(); public Order FindById(int id); public bool Exists(int id); - List Menu(int customerId, IEnumerable orderItems, string deliveryAddress); + public List Menu(string name, decimal totalprice, int userId, IEnumerable orderItems, string deliveryAddress, bool IsPaid = false); } } diff --git a/Interface/IPaymentRepository.cs b/Interface/IPaymentRepository.cs index 72573e8..7a57ed6 100644 --- a/Interface/IPaymentRepository.cs +++ b/Interface/IPaymentRepository.cs @@ -14,5 +14,6 @@ public interface IPaymentRepository public Payment Update(Payment payment); public List GetAll(); public bool Exists(int id); + public Payment FindByReference(string PaymentRef); } } diff --git a/Interface/IPaymentService.cs b/Interface/IPaymentService.cs index 31131ec..dc6a2ae 100644 --- a/Interface/IPaymentService.cs +++ b/Interface/IPaymentService.cs @@ -13,5 +13,6 @@ public interface IPaymentService public void Delete(int id); public List GetAll(); public Payment FindById(int id); + public Payment FindByReference(string PaymentRef); } } diff --git a/Models/Cart.cs b/Models/Cart.cs new file mode 100644 index 0000000..0ded90d --- /dev/null +++ b/Models/Cart.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace FOODEE.Models +{ + public class Cart: BaseEntity + { + public int userId { get; set; } + public User User { get; set; } + public int MenuItemId { get; set; } + + public MenuItem MenuItem { get; set; } = new MenuItem(); + } +} diff --git a/Models/Menu.cs b/Models/Menu.cs index 62ba69e..ad899ca 100644 --- a/Models/Menu.cs +++ b/Models/Menu.cs @@ -10,11 +10,13 @@ namespace FOODEE.Models public class Menu: BaseEntity { public string Name { get; set; } + public string Image { get; set; } public int MenuItemId { get; set; } - public int DisplayOrder { get; set; } public string Description { get; set; } public int Quantity { get; set; } - public ICollection MenuItems { get; set; } = new HashSet(); + // public MenuItem MenuItem { get; set; } + public ICollection MenuItem { get; set; } = new HashSet(); + public ICollection MenuMenuItems { get; set; } = new HashSet(); } } diff --git a/Models/Payment.cs b/Models/Payment.cs index 617a3be..9f1d788 100644 --- a/Models/Payment.cs +++ b/Models/Payment.cs @@ -10,5 +10,6 @@ public class Payment: BaseEntity public int OrderId { get; set; } public int UserId { get; set; } public User User { get; set; } + public string PaymentRef { get; set; } } } diff --git a/Models/ViewModel/MenuVM.cs b/Models/ViewModel/MenuVM.cs new file mode 100644 index 0000000..464385f --- /dev/null +++ b/Models/ViewModel/MenuVM.cs @@ -0,0 +1,55 @@ +using Microsoft.AspNetCore.Http; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Threading.Tasks; + +namespace FOODEE.Models.ViewModel +{ + public class MenuVM + { + public int Id { get; set; } + public string Name { get; set; } + public DateTime CreatedAt { get; set; } + public List MenuMenuItems { get; set; } + public string Title { get; set; } + public string Description { get; set; } + public IFormFile Image { get; set; } + public int MenuId { get; set; } + public string[] MenuItems { get; set; } + + public class CreateMenuViewModel + { + public int Id { get; set; } + [Required(ErrorMessage = "Menu name is required")] + [Display(Name = "Menu Name:")] + public string Name { get; set; } + + public DateTime CreatedAt { get; set; } + + [Required(ErrorMessage = "Image is required")] + [Display(Name = "Image")] + public IFormFile Image { get; set; } + + [Required(ErrorMessage = "Image is required")] + [Display(Name = "Description")] + public string Description { get; set; } + + public string[] MenuItems { get; set; } + } + + public class UpdateMenuViewModel + { + public int Id { get; set; } + + public DateTime CreatedAt { get; set; } + + [Display(Name = "Menu Name:")] + public string Name { get; set; } + + [Display(Description = "Image:")] + public string Image { get; set; } + } + } +} diff --git a/Repository/CartRepository.cs b/Repository/CartRepository.cs new file mode 100644 index 0000000..c406907 --- /dev/null +++ b/Repository/CartRepository.cs @@ -0,0 +1,56 @@ +using FOODEE.Context; +using FOODEE.Interface; +using FOODEE.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace FOODEE.Repository +{ + public class CartRepository: ICartRepository + { + private readonly FoodeeDbContext _dbContext; + public CartRepository(FoodeeDbContext dbContext) + { + _dbContext = dbContext; + } + public Cart Add(Cart cart) + { + _dbContext.Carts.Add(cart); + _dbContext.SaveChanges(); + return cart; + } + public IEnumerable GetCartsByUserId(int id) + { + return _dbContext.Carts.Where(c => c.userId == id).ToList(); + } + public Cart Update(Cart cart) + { + _dbContext.Carts.Update(cart); + _dbContext.SaveChanges(); + return cart; + } + public Cart FindById(int id) + { + return _dbContext.Carts.Find(id); + } + public void Delete(int id) + { + var cart = new Cart + { + Id = id + }; + if (cart != null) + { + _dbContext.Carts.Remove(cart); + _dbContext.SaveChanges(); + } + } + public List GetAll() + { + return _dbContext.Carts.ToList(); + + } + } +} diff --git a/Repository/MenuItemRepository.cs b/Repository/MenuItemRepository.cs index 92de874..826c4c6 100644 --- a/Repository/MenuItemRepository.cs +++ b/Repository/MenuItemRepository.cs @@ -47,7 +47,7 @@ public void Delete(int id) public List GetAll() { - return _dbContext.MenuItems.Include(m => m.MenuMenuItems).ThenInclude(m => m.Menu).ToList(); + return _dbContext.MenuItems.Include(m => m.MenuMenuItems).ThenInclude(m => m.Menu).OrderByDescending(d=> d.CreatedAt).ToList(); } diff --git a/Repository/MenuMenuItemRepository.cs b/Repository/MenuMenuItemRepository.cs index 0fbd08a..57a8823 100644 --- a/Repository/MenuMenuItemRepository.cs +++ b/Repository/MenuMenuItemRepository.cs @@ -1,6 +1,7 @@ using FOODEE.Context; using FOODEE.Interface; using FOODEE.Models; +using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq; @@ -27,6 +28,14 @@ public MenuMenuItem Update(MenuMenuItem menumenuitem) _dbContext.SaveChanges(); return menumenuitem; } + public List GetByMenu(int menuId) + { + return _dbContext.MenuMenuItems.Include(c => c.MenuItem).Where(c => c.MenuId == menuId).ToList(); + } + public List GetMenuByMenuItemId(int menuitemId) + { + return _dbContext.MenuMenuItems.Include(p => p.Menu).Where(p => p.MenuItemId == menuitemId).ToList(); + } public MenuMenuItem FindById(int id) { return _dbContext.MenuMenuItems.Find(id); diff --git a/Repository/MenuRepository.cs b/Repository/MenuRepository.cs index 917a99a..5dd6b4a 100644 --- a/Repository/MenuRepository.cs +++ b/Repository/MenuRepository.cs @@ -1,4 +1,5 @@ using FOODEE.Context; +using FOODEE.DTO; using FOODEE.Interface; using FOODEE.Models; using Microsoft.EntityFrameworkCore; @@ -22,6 +23,7 @@ public Menu Add(Menu menu) _dbContext.SaveChanges(); return menu; } + public Menu FindById(int id) { return _dbContext.Menus.Find(id); @@ -45,10 +47,15 @@ public Menu Update(Menu menu) public List GetAll() { return _dbContext.Menus - .Include(m => m.MenuItems) + .Include(m => m.MenuMenuItems) .ToList(); } + + public IEnumerable GetAllMenus() + { + return _dbContext.Menus.ToList(); + } public bool Exists(int id) { return _dbContext.Menus.Any(e => e.Id == id); diff --git a/Repository/PaymentRepository.cs b/Repository/PaymentRepository.cs index 3c072d2..294f21e 100644 --- a/Repository/PaymentRepository.cs +++ b/Repository/PaymentRepository.cs @@ -25,7 +25,10 @@ public Payment FindById(int id) { return _dbContext.Payments.Find(id); } - + public Payment FindByReference(string PaymentRef) + { + return _dbContext.Payments.Find(PaymentRef); + } public void Delete(int id) { var payment = FindById(id); diff --git a/Service/CartService.cs b/Service/CartService.cs new file mode 100644 index 0000000..fc2977d --- /dev/null +++ b/Service/CartService.cs @@ -0,0 +1,49 @@ +using FOODEE.Interface; +using FOODEE.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace FOODEE.Service +{ + public class CartService + { + private readonly ICartRepository cartRepository; + + public CartService(ICartRepository cartRepository) + { + this.cartRepository = cartRepository; + } + + public Cart FindById(int id) + { + return cartRepository.FindById(id); + } + + public Cart Add(Cart cart) + { + return cartRepository.Add(cart); + } + + public Cart Update(Cart cart) + { + return cartRepository.Update(cart); + } + + public void Delete(int id) + { + cartRepository.Delete(id); + } + + public List GetAll() + { + return cartRepository.GetAll(); + + } + public IEnumerable GetCartsByUserId(int id) + { + return cartRepository.GetCartsByUserId(id); + } + } +} diff --git a/Service/CustomerService.cs b/Service/CustomerService.cs new file mode 100644 index 0000000..db3bc0a --- /dev/null +++ b/Service/CustomerService.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace FOODEE.Service +{ + public class CustomerService + { + } +} diff --git a/Service/MenuMenuItemService.cs b/Service/MenuMenuItemService.cs index 710d368..32f34f8 100644 --- a/Service/MenuMenuItemService.cs +++ b/Service/MenuMenuItemService.cs @@ -9,30 +9,37 @@ namespace FOODEE.Service { public class MenuMenuItemService: IMenuMenuItemService { - private readonly IMenuMenuItemRepository menumenuItemRepository; + private readonly IMenuMenuItemRepository menumenuitemRepository; - public MenuMenuItemService(IMenuMenuItemRepository menumenuItemRepository) + public MenuMenuItemService(IMenuMenuItemRepository menumenuitemRepository) { - this.menumenuItemRepository = menumenuItemRepository; + this.menumenuitemRepository = menumenuitemRepository; } public MenuMenuItem FindById(int id) { - return menumenuItemRepository.FindById(id); + return menumenuitemRepository.FindById(id); } public MenuMenuItem Add(MenuMenuItem menumenuItem) { - return menumenuItemRepository.Add(menumenuItem); + return menumenuitemRepository.Add(menumenuItem); } public MenuMenuItem Update(MenuMenuItem menumenuItem) { - return menumenuItemRepository.Update(menumenuItem); + return menumenuitemRepository.Update(menumenuItem); + } + public IEnumerable GetMenuByMenuItemId(int menuitemId) + { + return menumenuitemRepository.GetMenuByMenuItemId(menuitemId); + } + public IEnumerable GetByMenu(int menuId) + { + return menumenuitemRepository.GetByMenu(menuId); } - public void Delete(int id) { - menumenuItemRepository.Delete(id); + menumenuitemRepository.Delete(id); } } } diff --git a/Service/MenuService.cs b/Service/MenuService.cs index db25690..d9ecb63 100644 --- a/Service/MenuService.cs +++ b/Service/MenuService.cs @@ -1,4 +1,5 @@ -using FOODEE.Interface; +using FOODEE.DTO; +using FOODEE.Interface; using FOODEE.Models; using System; using System.Collections.Generic; @@ -11,18 +12,28 @@ public class MenuService: IMenuService { private readonly IMenuRepository menuRepository; - public MenuService(IMenuRepository categoryRepository) + public MenuService(IMenuRepository menuRepository) { - this.menuRepository = categoryRepository; + this.menuRepository = menuRepository; } public Menu FindById(int id) { return menuRepository.FindById(id); } - public Menu Add(Menu menu) + public Menu Add(MenuDto menuDto) { - return menuRepository.Add(menu); + + var menu = new Menu + { + Id = menuDto.Id, + Image = menuDto.Image, + Quantity = menuDto.Quantity, + Description = menuDto.Description, + Name = menuDto.Name, + }; + menuRepository.Add(menu); + return menu; } public Menu Update(Menu menu) @@ -35,6 +46,18 @@ public void Delete(int id) menuRepository.Delete(id); } + public IEnumerable GetAllMenus() + { + var menus = menuRepository.GetAllMenus().Select(c => new Menu + { + Id = c.Id, + CreatedAt = DateTime.Now, + Name = c.Name, + Image = c.Image, + }).ToList(); + + return menus; + } public List GetAll() { return menuRepository.GetAll(); diff --git a/Service/OrderService.cs b/Service/OrderService.cs index 0fa2bd1..83f03c5 100644 --- a/Service/OrderService.cs +++ b/Service/OrderService.cs @@ -46,13 +46,14 @@ public bool Exists(int id) return orderRepository.Exists(id); } - public List Menu(int userId, IEnumerable orderItems, string deliveryAddress) + public List Menu(string name, decimal totalprice, int userId, IEnumerable orderItems, string deliveryAddress, bool IsPaid = false) { var menuitemDictionary = orderItems.ToDictionary(o => o.MenuItemId); var menuitems = menuitemRepository.GetAll(menuitemDictionary.Keys); var order = new Order { Id = userId, + TotalPrice = totalprice, DeliveryAddress = deliveryAddress, Status = OrderStatus.Default, CreatedAt = DateTime.Now @@ -66,15 +67,17 @@ public List Menu(int userId, IEnumerable orderItems, string del Id = menuitem.Id, Quantity = quantity, Order = order, - UnitPrice = price, + UnitPrice = totalprice, MenuItem = menuitem }; - order.TotalPrice += price * quantity; + order.TotalPrice += totalprice * quantity; order.OrderItems.Add(orderItem); } orderRepository.Add(order); return order.OrderItems.ToList(); } + + } } diff --git a/Service/PaymentService.cs b/Service/PaymentService.cs index b65688c..b0e909a 100644 --- a/Service/PaymentService.cs +++ b/Service/PaymentService.cs @@ -19,6 +19,10 @@ public Payment FindById(int id) { return paymentRepository.FindById(id); } + public Payment FindByReference(string PaymentRef) + { + return paymentRepository.FindByReference(PaymentRef); + } public Payment Add(Payment payment) { diff --git a/Utility/WebClient.cs b/Utility/WebClient.cs new file mode 100644 index 0000000..10ca65e --- /dev/null +++ b/Utility/WebClient.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace FOODEE.Utility +{ + public class WebClient + { + } +} diff --git a/Views/Customer/GetByMenu.cshtml b/Views/Customer/GetByMenu.cshtml new file mode 100644 index 0000000..eac419a --- /dev/null +++ b/Views/Customer/GetByMenu.cshtml @@ -0,0 +1,113 @@ +@model IEnumerable + @{ ViewData["Title"] = "Menu Item"; } + @{ + Layout = "_CustomerDashboardLayout"; + } +
@ViewBag.Menu
+
+ @foreach (var item in Model) + { +
+ + Image + +
+ @item.Name@item.Price +
+ + Served with French Fries + Drinks +

@item.Description

+ +
+ + } + +
+ + + + + + + + + + + + + + diff --git a/Views/Customer/Index.cshtml b/Views/Customer/Index.cshtml new file mode 100644 index 0000000..00f00f2 --- /dev/null +++ b/Views/Customer/Index.cshtml @@ -0,0 +1,43 @@ +@model IEnumerable +@{ + Layout = "_CustomerDashboardLayout"; +} + +
+
+
+
+

Menu

+
+
+
+

+ +
+
+ @if (Model.Count() > 0) + { + @foreach (var menu in Model) + { +
+ + Image + +
+ @menu.Name +
+
+
+ + } + } + + else + { +

No Menu exists.

+ } +
+
+
+ + diff --git a/Views/Home/Index.cshtml b/Views/Home/Index.cshtml index 98ceb37..549ee51 100644 --- a/Views/Home/Index.cshtml +++ b/Views/Home/Index.cshtml @@ -1,5 +1,8 @@ @model IEnumerable @{ ViewData["Title"] = "Home Page"; } +@{ + Layout = "_Layout"; +}
FOODEE HOMIE
@@ -7,12 +10,12 @@ {
- Image + Image

@item.Name

₦ @item.Price

- +
} @@ -31,7 +34,7 @@
@@ -80,4 +83,10 @@ - \ No newline at end of file + + +@* +*@ \ No newline at end of file diff --git a/Views/Home/ViewCart.cshtml b/Views/Home/ViewCart.cshtml index fc32c40..a77c3c7 100644 --- a/Views/Home/ViewCart.cshtml +++ b/Views/Home/ViewCart.cshtml @@ -1,4 +1,11 @@ -
+@{ + Layout = "_DashboardLayout"; +} + +@{ + ViewBag.Title = "Cart"; +} + + + \ No newline at end of file diff --git a/Views/Menu/Add.cshtml b/Views/Menu/Add.cshtml index 0b0f0a0..f764490 100644 --- a/Views/Menu/Add.cshtml +++ b/Views/Menu/Add.cshtml @@ -1,57 +1,46 @@ -@model FOODEE.Models.Menu -
-
-
+@model FOODEE.Models.ViewModel.MenuVM.CreateMenuViewModel -
-

Add Menu

+@{ + Layout = "_DashboardLayout"; + + ViewBag.Title = "Menu"; +} +
+
+ +
+

Add Menu

-
-
-
-
- - -
-
-
-
- - -
+
-
-
-
- - -
+ + +
+ +
+ + +
+ +
-
-
- -
- -
- -
+
+
-
-
- @* Keep this empty *@ -
+ + +
- -@section Scripts{ - @{ - -} -} +
+ + + +@section Scripts { + + @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} +} \ No newline at end of file diff --git a/Views/Menu/Delete.cshtml b/Views/Menu/Delete.cshtml new file mode 100644 index 0000000..c15e995 --- /dev/null +++ b/Views/Menu/Delete.cshtml @@ -0,0 +1,62 @@ +@model FOODEE.Models.Menu +
+ +
+ +
+

Are You Sure You Want To Delete This Information Below

+
+
+
+
+
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+ +
+
+
+
+ @* Keep this empty *@ +
+
+
+
+@section Scripts{ + @{ + } +} diff --git a/Views/Menu/Detail.cshtml b/Views/Menu/Detail.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/Views/Menu/Detail.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/Views/Menu/Edit.cshtml b/Views/Menu/Edit.cshtml new file mode 100644 index 0000000..e836577 --- /dev/null +++ b/Views/Menu/Edit.cshtml @@ -0,0 +1,65 @@ +@model FOODEE.Models.Menu +
+ +
+ +
+

Edit Menu

+
+
+
+
+
+ +
+
+ + +
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+ +
+
+ + +
+ +
+
+
+ +
+ +
+ +
+
+
+
+ @* Keep this empty *@ +
+
+
+
+@section Scripts{ + @{ + } +} diff --git a/Views/Menu/GetByMenu.cshtml b/Views/Menu/GetByMenu.cshtml new file mode 100644 index 0000000..e11da0f --- /dev/null +++ b/Views/Menu/GetByMenu.cshtml @@ -0,0 +1,112 @@ +@model IEnumerable +@{ ViewData["Title"] = "Menu Item"; } +@{ + Layout = "_CustomerDashboardLayout"; +} +
@ViewBag.Menu
+
+ @foreach (var item in Model) + { +
+ + Image + +
+ @item.Name@item.Price +
+ + Served with French Fries + Drinks +

@item.Description

+ +
+ + } + +
+ + + + + + + + + + + + + diff --git a/Views/Menu/Index.cshtml b/Views/Menu/Index.cshtml index 40dd6a3..95bbbcc 100644 --- a/Views/Menu/Index.cshtml +++ b/Views/Menu/Index.cshtml @@ -3,41 +3,42 @@ Layout = "_Layout"; } -@{ - ViewData["Title"] = "Index"; -} -

Available Foods

- -
-
- - - - - - - +
+
+
+
+

Menu

+
+
+
+

-
- - - @foreach (var product in Model) +
+
+ @if (Model.Count() > 0) + { + @foreach (var menu in Model) { -
- - - - - +
+ + Image + +
+ @menu.Name +
+
+
+ } - -
NameDescriptionDisplayOrderAction
@product.Name @product.Description @product.DisplayOrder - Update - Delete -
+ } + + else + { +

No Menu exists.

+ } +
-
- + + + diff --git a/Views/Menu/IndexAdmin.cshtml b/Views/Menu/IndexAdmin.cshtml new file mode 100644 index 0000000..305c8dc --- /dev/null +++ b/Views/Menu/IndexAdmin.cshtml @@ -0,0 +1,43 @@ +@model IEnumerable +@{ + Layout = "_SuperAdminDashboard"; +} + +
+
+
+

Menu

+
+ +
+

+ +
+
+ @foreach (var menu in Model) + { +
+ + Image + +
+ @menu.Name +
+
+
+
+ + + +
+ + } + +
+
+
\ No newline at end of file diff --git a/Views/MenuItem/Add.cshtml b/Views/MenuItem/Add.cshtml index 8c9dd2f..c7e12e7 100644 --- a/Views/MenuItem/Add.cshtml +++ b/Views/MenuItem/Add.cshtml @@ -1,6 +1,6 @@ @model FOODEE.Models.ViewModel.MenuItemVM @{ - Layout = "_Layout"; + Layout = "_SuperAdminDashboard"; } @{ @@ -45,7 +45,7 @@
@section Scripts { diff --git a/Views/MenuItem/Delete.cshtml b/Views/MenuItem/Delete.cshtml new file mode 100644 index 0000000..745a456 --- /dev/null +++ b/Views/MenuItem/Delete.cshtml @@ -0,0 +1,70 @@ +@model FOODEE.Models.MenuItem +
+ +
+ +
+

Are You Sure You Want To Delete This Information Below

+
+
+
+
+
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+ +
+
+
+
+ @* Keep this empty *@ +
+
+
+
+@section Scripts{ + @{ + } +} diff --git a/Views/MenuItem/Details.cshtml b/Views/MenuItem/Details.cshtml new file mode 100644 index 0000000..f95bd3b --- /dev/null +++ b/Views/MenuItem/Details.cshtml @@ -0,0 +1,42 @@ +@model FOODEE.Models.MenuItem +@{ ViewBag.Title = "Details"; } + +@{ + + Layout = "_CustomerDashboardLayout"; + +} + + +Image + +
+
+
+ + + *Food Type: @Model.Name

+ + *Food Price: @Model.Description

+ + *Food Description: @Model.Price

+
+
+ diff --git a/Views/MenuItem/Index.cshtml b/Views/MenuItem/Index.cshtml index 218907e..8e6aaea 100644 --- a/Views/MenuItem/Index.cshtml +++ b/Views/MenuItem/Index.cshtml @@ -1,45 +1,113 @@ -@*@model IEnumerable +@model IEnumerable +@{ ViewData["Title"] = "Menu Item"; } @{ - Layout = "_Layout"; + Layout = "_SuperAdminDashboard"; } +
@ViewBag.Menu
+ +
+ @foreach (var item in Model) + { +
+ + Image + +
+ @item.Name@item.Price +
+ + Served with French Fries + Drinks +

@item.Description

+ +
+ + } -@{ - ViewData["Title"] = "Index"; -} -

Available Foods

- -
-
- - - - - - - - - - - - - @foreach (var product in Model) - { - - - - - - - - } - -
MenuMenuItemPriceDescriptionAction
@product.MenuId @product.Name @product.Price @product.Description - Update - Delete -
-
-
-*@ \ No newline at end of file + + +
+ + + + + + diff --git a/Views/MenuItem/IndexAdmin.cshtml b/Views/MenuItem/IndexAdmin.cshtml new file mode 100644 index 0000000..35baf54 --- /dev/null +++ b/Views/MenuItem/IndexAdmin.cshtml @@ -0,0 +1,114 @@ +@model IEnumerable +@{ ViewData["Title"] = "Menu Item"; } +@{ + Layout = "_SuperAdminDashboard"; +} +
@ViewBag.Menu
+ +
+ @foreach (var item in Model) + { +
+ + Image + +
+ @item.Name@item.Price +
+ + Served with French Fries + Drinks +

@item.Description

+ +
+ + } + +
+ + +
+ + + + + + diff --git a/Views/MenuItem/IndexAnonymous.cshtml b/Views/MenuItem/IndexAnonymous.cshtml new file mode 100644 index 0000000..edcf551 --- /dev/null +++ b/Views/MenuItem/IndexAnonymous.cshtml @@ -0,0 +1,218 @@ +@model IEnumerable +@{ ViewData["Title"] = "Home Page"; } +@{ + Layout = "_Layout"; +} + + + + +
+
+
+ @foreach (var item in Model) + { +
+ + Image + +
+ @item.Name@item.Price +
+ Served with French Fries + Drinks +

@item.Description

+ @**@ + +
+ } +
+ + + + +
+ \ No newline at end of file diff --git a/Views/Order/Add.cshtml b/Views/Order/Add.cshtml index 399a8fc..a9bbef2 100644 --- a/Views/Order/Add.cshtml +++ b/Views/Order/Add.cshtml @@ -22,11 +22,6 @@ ₦
-
- - - -
diff --git a/Views/Order/CheckOut.cshtml b/Views/Order/CheckOut.cshtml index 570e018..121027b 100644 --- a/Views/Order/CheckOut.cshtml +++ b/Views/Order/CheckOut.cshtml @@ -1,67 +1,51 @@ -
-
-
-
-
-
- - -
- -
-
+@model FOODEE.Models.Order +@{ + Layout = "_CustomerDashboardLayout"; +} + +@{ + ViewBag.Title = "CheckOut"; +} +
+
CheckOut
+
+
+
+
+

UserName:

+
@ViewBag.UserName
+
+
+

Email

+
@ViewBag.Email
+

+
+

PhoneNumber

+
@ViewBag.PhoneNumber
+
+
+

Delivery Address

+

@ViewBag.Address

- +
+
-
+
+
- Shopping Basket - + FOODEE CART
- - -
- + -@section Scripts { - -} diff --git a/Views/Order/Payment.cshtml b/Views/Order/Payment.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/Views/Order/Payment.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/Views/Shared/_CustomerDashboardLayout.cshtml b/Views/Shared/_CustomerDashboardLayout.cshtml new file mode 100644 index 0000000..32f5d47 --- /dev/null +++ b/Views/Shared/_CustomerDashboardLayout.cshtml @@ -0,0 +1,87 @@ + + + + + + + + + @ViewData["Title"] - FOODEE + + + + + + + + +
+ +
+
+
+ @RenderBody() +
+
+ + @*
+
+ © 2021 - FOODEE - Privacy +
+
*@ + + + + + + + + + + + + + + + + + @await RenderSectionAsync("Scripts", required: false) + + + diff --git a/Views/Shared/_DashboardLayout.cshtml b/Views/Shared/_DashboardLayout.cshtml index 52b16f8..b005fae 100644 --- a/Views/Shared/_DashboardLayout.cshtml +++ b/Views/Shared/_DashboardLayout.cshtml @@ -3,7 +3,7 @@ - > + @ViewData["Title"] - FOODEE @@ -11,32 +11,54 @@ - - - - - - - - - - - + + + + + + + + + @* + + + + + + + + + + + *@
-
+
@@ -63,6 +85,8 @@ + + @await RenderSectionAsync("Scripts", required: false) - \ No newline at end of file + diff --git a/Views/Shared/_Layout.cshtml b/Views/Shared/_Layout.cshtml index e16c41d..fdb2c37 100644 --- a/Views/Shared/_Layout.cshtml +++ b/Views/Shared/_Layout.cshtml @@ -1,9 +1,10 @@ - + + - > + @ViewData["Title"] - FOODEE @@ -11,50 +12,50 @@ - - - - - - - - - - - + -
-
@@ -64,11 +65,7 @@
- @*
-
- © 2021 - FOODEE - Privacy -
-
*@ + diff --git a/Views/Shared/_SuperAdminDashboard.cshtml b/Views/Shared/_SuperAdminDashboard.cshtml new file mode 100644 index 0000000..d595589 --- /dev/null +++ b/Views/Shared/_SuperAdminDashboard.cshtml @@ -0,0 +1,68 @@ + + + + + + + + + @ViewData["Title"] - FOODEE + + + + + + + + +
+ +
+
+
+ @RenderBody() +
+
+ + @*
+
+ © 2021 - FOODEE - Privacy +
+
*@ + + + + + + + + + + + + + + + + + @await RenderSectionAsync("Scripts", required: false) + + + diff --git a/Views/SuperAdmin/Add.cshtml b/Views/SuperAdmin/Add.cshtml new file mode 100644 index 0000000..d687afe --- /dev/null +++ b/Views/SuperAdmin/Add.cshtml @@ -0,0 +1,46 @@ +@model FOODEE.Models.ViewModel.MenuVM.CreateMenuViewModel + +@{ + Layout = "_SuperAdminDashboard"; + + ViewBag.Title = "Menu"; +} +
+
+ +
+

Add Menu

+
+ +
+ +
+ +
+ +
+ + +
+ + +
+
+
+ +
+ +
+ +
+
+
+ + + +@section Scripts { + + @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} +} diff --git a/Views/SuperAdmin/Delete.cshtml b/Views/SuperAdmin/Delete.cshtml new file mode 100644 index 0000000..66de5d5 --- /dev/null +++ b/Views/SuperAdmin/Delete.cshtml @@ -0,0 +1,68 @@ +@model FOODEE.Models.Menu +
+ +
+ +
+

Are You Sure You Want To Delete This Information Below

+
+
+
+
+
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+ + + + + +
+ +
+
+
+
+ @* Keep this empty *@ +
+
+
+
+@section Scripts{ + @{ + } +} diff --git a/Views/SuperAdmin/Detail.cshtml b/Views/SuperAdmin/Detail.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/Views/SuperAdmin/Detail.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/Views/SuperAdmin/Edit.cshtml b/Views/SuperAdmin/Edit.cshtml new file mode 100644 index 0000000..ad79ee4 --- /dev/null +++ b/Views/SuperAdmin/Edit.cshtml @@ -0,0 +1,65 @@ +@model FOODEE.Models.Menu +
+ +
+ +
+

Edit Menu

+
+
+
+
+
+ +
+
+ + +
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+ +
+
+ + +
+ +
+
+
+ +
+ +
+ +
+
+
+
+ @* Keep this empty *@ +
+
+
+
+@section Scripts{ + @{ + } + } diff --git a/Views/SuperAdmin/Index.cshtml b/Views/SuperAdmin/Index.cshtml index 12345fa..1952b83 100644 --- a/Views/SuperAdmin/Index.cshtml +++ b/Views/SuperAdmin/Index.cshtml @@ -1,123 +1,43 @@ -@*@model FOODEE.Models.MenuItem -@{ ViewData["Title"] = "Home Page"; } -
FOODEE HOMIE
-
-
- - @foreach (var menu in Model.Menus) - { - - } -
-
-
- @foreach (var prod in Model.MenuItems) - { - - //display all product - } -
-
-
-
- @foreach (var item in Model.MenuItems) - { -
- - Image - -

@item.Name

-

₦ @item.Price

- - +@model IEnumerable +@{ + Layout = "_SuperAdminDashboard"; +} + +
+
+
+ + + Add Menu + +
+

Menu

- } - +
- -
-