public async Task <IActionResult> Update(UpdateNavBarMenuItemInput model) { if (ModelState.IsValid) { await _navBarMenuItemService.Update(model); return(RedirectToAction("Index")); } return(View(model)); }
public async Task <IActionResult> Update(int id) { var item = await _navBarMenuItemService.Get(id); UpdateNavBarMenuItemInput model = new UpdateNavBarMenuItemInput { Id = item.Id, Icon = item.Icon, IsAnonym = item.IsAnonym, OpenInSamePage = item.OpenInSamePage, Roles = item.Roles, Title = item.Title, Url = item.Url, Order = item.Order }; return(View(model)); }
public async Task <NavBarMenuItem> Update(UpdateNavBarMenuItemInput input) { var navbarItem = await Get(input.Id); if (navbarItem.Order != input.Order) { await OrderNumberFix(input.Order); } navbarItem.Icon = input.Icon; navbarItem.IsAnonym = string.IsNullOrEmpty(input.Roles) ? input.IsAnonym : false; // roller bossa => gelen is anonym neyse onu yap // roller doluysa => isanonym'i false don navbarItem.OpenInSamePage = input.OpenInSamePage; navbarItem.Roles = input.Roles; navbarItem.Title = input.Title; navbarItem.Url = input.Url; navbarItem.Order = input.Order; _context.NavBarMenuItems.Update(navbarItem); await _context.SaveChangesAsync(); return(navbarItem); }