public ActionResult Index() { var menuItems = _menuService.Get(); var menuItemsViewModel = Mapper.Map <IEnumerable <MenuItem>, IEnumerable <MenuItemViewModel> >(menuItems); return(View(menuItemsViewModel)); }
// GET: MenuItems/Details/5 public async Task <IActionResult> Details(int?id) { if (id == null) { return(NotFound()); } var menuItem = await _menuItemsService.Get(id); if (menuItem == null) { return(NotFound()); } return(View(menuItem)); }
public ActionResult Create() { var menuItemsViewModel = Mapper .Map <IEnumerable <MenuItem>, IEnumerable <MenuItemViewModel> >(_menuItemsService.Get()); ViewBag.Menu = menuItemsViewModel; return(View()); }