コード例 #1
0
        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();
        }
コード例 #2
0
 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
             }
         }
     }
 }
コード例 #3
0
 public void UpdateMenu(CustomizeMenuInput customizeMenuInput)
 {
     repo.UpdateMenu(customizeMenuInput);
 }
コード例 #4
0
 public void AddMenu(CustomizeMenuInput customizeMenuInput)
 {
     repo.AddMenu(customizeMenuInput);
 }