public async Task <IActionResult> MenuForm() { if (User.Identities != null) { var _menuCategoryNames = await mediator.Send(new GetMenuCategoryListQuery()); List <SelectListItem> _list = new List <SelectListItem>(); foreach (var item in _menuCategoryNames) { _list.Add(new SelectListItem { Value = item.ID.ToString(), Text = item.Category }); } var _addEventList = new AddMenuCVM(); _addEventList.CategoryList = _list; return(View(_addEventList)); } else { return(Redirect("/Login")); } }
public async Task <IActionResult> MenuList() { var _menu = await mediator.Send(new GetMenuListQuery()); var _menuCategoryNames = await mediator.Send(new GetMenuCategoryListQuery()); List <SelectListItem> _list = new List <SelectListItem>(); foreach (var item in _menuCategoryNames) { _list.Add(new SelectListItem { Value = item.ID.ToString(), Text = item.Category }); } AddMenuCVM add = new AddMenuCVM { MenuList = _menu, CategoryList = _list }; return(View(add)); }
public async Task <IActionResult> AddMenu(AddMenuCVM _menuDetails) { MenuVM menuDetails = new MenuVM { Name = _menuDetails.Menu.Name, Description = _menuDetails.Menu.Description, MenuCategoryID = _menuDetails.Selected }; var response = await mediator.Send(new AddMenuCommand { PackageMenu = menuDetails }); return(Json(response)); }