Пример #1
0
 public async Task Edit(OperateModule query)
 {
     using (_unitOfWorkManager.Current.DisableFilter(AbpDataFilters.MayHaveTenant))
     {
         // var query = await _Repository.FirstOrDefaultAsync(c => c.Id == model.Id);
         if (query.TenantId == 0)
         {
             Entity.OperateModule module = new Entity.OperateModule();
             query.TenantId  = (int)AbpSession.TenantId;
             module.KeyName  = query.KeyName;
             module.Type     = query.Type;
             module.Title    = query.Title;
             module.TenantId = (int)AbpSession.TenantId;
             module.Visabled = !query.Visabled;
             module.Memo     = query.Memo;
             module.LinkUrl  = query.LinkUrl;
             module.Icon     = query.Icon;
             module.Sort     = query.Sort;
             await _Repository.InsertAsync(module);
         }
         else
         {
             // model.TenantId = (int)AbpSession.TenantId;
             await _Repository.UpdateAsync(query);
         }
     }
 }
Пример #2
0
        //[RemoteService(IsEnabled = false)]
        public async Task ChangeStatus(long id)
        {
            using (_unitOfWorkManager.Current.DisableFilter(AbpDataFilters.MayHaveTenant))
            {
                var query = await _Repository.FirstOrDefaultAsync(c => c.Id == id);

                int s = (int)AbpSession.TenantId;
                if (query.TenantId == (int)AbpSession.TenantId)
                {
                    if (query.Visabled)
                    {
                        query.Visabled = false;
                    }
                    else
                    {
                        query.Visabled = true;
                    }

                    await _Repository.UpdateAsync(query);
                }
                else
                {
                    // query = await _Repository.FirstOrDefaultAsync(c => c.Id == id && c.TenantId == 0);
                    Entity.OperateModule module = new Entity.OperateModule();
                    module.KeyName  = query.KeyName;
                    module.Type     = query.Type;
                    module.Title    = query.Title;
                    module.TenantId = (int)AbpSession.TenantId;
                    module.Visabled = !query.Visabled;
                    module.Memo     = query.Memo;
                    module.LinkUrl  = query.LinkUrl;
                    module.Icon     = query.Icon;
                    module.Sort     = query.Sort;
                    await _Repository.InsertAsync(module);
                }
            }
        }