public void UpdateMenu(CustomizeMenuInput customizeMenuInput) { var item = ctx.CustomizeMenus.Single(t => t.Id == customizeMenuInput.Id); item.ActionId = customizeMenuInput.ActionId; item.ActionType = customizeMenuInput.ActionType; item.ParentId = customizeMenuInput.ParentId; item.SortCode = customizeMenuInput.SortCode; item.Title = customizeMenuInput.Title; ctx.SaveChanges(); }
public void AddMenu(CustomizeMenuInput customizeMenuInput) { lock (ctx) { using (var transaction = ctx.Database.BeginTransaction()) { try { if (customizeMenuInput.ActionType == MenuActionType.链接) { AddMenuLink(customizeMenuInput.Title, customizeMenuInput.Url, customizeMenuInput.ParentId, customizeMenuInput.UserId, customizeMenuInput.AppId, customizeMenuInput.TenantId ); } else if (customizeMenuInput.ActionType == MenuActionType.图文 || customizeMenuInput.ActionType == MenuActionType.多图文) { AddNewsLink(customizeMenuInput.Title, customizeMenuInput.NewsId, customizeMenuInput.ActionType, customizeMenuInput.ParentId, customizeMenuInput.UserId, customizeMenuInput.AppId, customizeMenuInput.TenantId ); } ctx.SaveChanges(); transaction.Commit(); } catch (Exception) { // TODO: Handle failure } } } }
public void UpdateMenu(CustomizeMenuInput customizeMenuInput) { repo.UpdateMenu(customizeMenuInput); }
public void AddMenu(CustomizeMenuInput customizeMenuInput) { repo.AddMenu(customizeMenuInput); }