public IActionResult Put(int id, [FromBody] sys_menu value) { var menuDb = _sysMenuRpt.GetSingle(id); if (menuDb == null) { return(NotFound()); } menuDb.MenuName = value.MenuName; menuDb.MenuOrder = value.MenuOrder; menuDb.RoleIds = value.RoleIds; menuDb.MenuAddr = value.MenuAddr; menuDb.Icon = value.Icon; menuDb.UpdatedAt = DateTime.Now; menuDb.FormName = value.FormName; menuDb.IsValid = true; using (var tran = _context.Database.BeginTransaction()) { try { _sysMenuRpt.Commit(); this.SetMenuRoles(menuDb); tran.Commit(); } catch (Exception e) { Console.WriteLine(e); tran.Rollback(); return(new BadRequestResult());; } } return(new NoContentResult()); }
public IActionResult Edit(string id) { return(View(menuRepository.GetSingle(id))); }