コード例 #1
0
 public ActionResult Edit(DataPrivilegeVM vm)
 {
     if (!ModelState.IsValid)
     {
         return(PartialView(vm));
     }
     else
     {
         vm.DoEdit();
         return(FFResult().CloseDialog().RefreshGrid());
     }
 }
コード例 #2
0
 public DataPrivilegeVM Get(string TableName, string TargetId, DpTypeEnum DpType)
 {
     DataPrivilegeVM vm = null;
     if (DpType == DpTypeEnum.User)
     {
         vm = Wtm.CreateVM<DataPrivilegeVM>(values: x => x.Entity.TableName == TableName && x.Entity.UserCode == TargetId && x.DpType == DpType);
     }
     else
     {
         vm = Wtm.CreateVM<DataPrivilegeVM>(values: x => x.Entity.TableName == TableName && x.Entity.GroupCode == TargetId && x.DpType == DpType);
     }
     return vm;
 }
コード例 #3
0
        public async Task <ActionResult> Edit(DataPrivilegeVM vm)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView(vm));
            }
            else
            {
                await vm.DoEditAsync();

                return(FFResult().CloseDialog().RefreshGrid());
            }
        }
コード例 #4
0
 public async Task<ActionResult> Delete(SimpleDpModel dp)
 {
     DataPrivilegeVM vm = null;
     if (dp.Type == DpTypeEnum.User)
     {
         vm = Wtm.CreateVM<DataPrivilegeVM>(values: x => x.Entity.TableName == dp.ModelName && x.Entity.UserCode == dp.Id && x.DpType == dp.Type);
     }
     else
     {
         vm = Wtm.CreateVM<DataPrivilegeVM>(values: x => x.Entity.TableName == dp.ModelName && x.Entity.GroupCode == dp.Id && x.DpType == dp.Type);
     }
     await vm.DoDeleteAsync();
     return Ok(1);
 }
コード例 #5
0
        public ActionResult Edit(string ModelName, string Id, DpTypeEnum Type)
        {
            DataPrivilegeVM vm = null;

            if (Type == DpTypeEnum.User)
            {
                vm = Wtm.CreateVM <DataPrivilegeVM>(values: x => x.Entity.TableName == ModelName && x.Entity.UserCode == Id && x.DpType == Type);
            }
            else
            {
                vm = Wtm.CreateVM <DataPrivilegeVM>(values: x => x.Entity.TableName == ModelName && x.Entity.GroupCode == Id && x.DpType == Type);
            }
            return(PartialView(vm));
        }
コード例 #6
0
        public ActionResult Delete(string ModelName, Guid Id, DpTypeEnum Type)
        {
            DataPrivilegeVM vm = null;

            if (Type == DpTypeEnum.User)
            {
                vm = CreateVM <DataPrivilegeVM>(values: x => x.Entity.TableName == ModelName && x.Entity.UserId == Id && x.DpType == Type);
            }
            else
            {
                vm = CreateVM <DataPrivilegeVM>(values: x => x.Entity.TableName == ModelName && x.Entity.GroupId == Id && x.DpType == Type);
            }
            vm.DoDelete();
            return(FFResult().RefreshGrid());
        }
コード例 #7
0
        public ActionResult Edit(string ModelName, Guid Id, DpTypeEnum Type)
        {
            DataPrivilegeVM vm = null;

            if (Type == DpTypeEnum.User)
            {
                vm            = CreateVM <DataPrivilegeVM>(values: x => x.Entity.TableName == ModelName && x.Entity.UserId == Id && x.DpType == Type);
                vm.UserItCode = DC.Set <FrameworkUserBase>().Where(x => x.ID == Id).Select(x => x.ITCode).FirstOrDefault();
            }
            else
            {
                vm = CreateVM <DataPrivilegeVM>(values: x => x.Entity.TableName == ModelName && x.Entity.GroupId == Id && x.DpType == Type);
            }
            return(PartialView(vm));
        }
コード例 #8
0
        public DataPrivilegeVM Get(string TableName, Guid TargetId, DpTypeEnum DpType)
        {
            DataPrivilegeVM vm = null;

            if (DpType == DpTypeEnum.User)
            {
                vm            = CreateVM <DataPrivilegeVM>(values: x => x.Entity.TableName == TableName && x.Entity.UserId == TargetId && x.DpType == DpType);
                vm.UserItCode = DC.Set <FrameworkUserBase>().Where(x => x.ID == TargetId).Select(x => x.ITCode).FirstOrDefault();
            }
            else
            {
                vm = CreateVM <DataPrivilegeVM>(values: x => x.Entity.TableName == TableName && x.Entity.GroupId == TargetId && x.DpType == DpType);
            }
            return(vm);
        }
コード例 #9
0
        public async Task <ActionResult> Delete(string ModelName, string Id, DpTypeEnum Type)
        {
            DataPrivilegeVM vm = null;

            if (Type == DpTypeEnum.User)
            {
                vm = Wtm.CreateVM <DataPrivilegeVM>(values: x => x.Entity.TableName == ModelName && x.Entity.UserCode == Id && x.DpType == Type);
            }
            else
            {
                vm = Wtm.CreateVM <DataPrivilegeVM>(values: x => x.Entity.TableName == ModelName && x.Entity.GroupCode == Id && x.DpType == Type);
            }
            await vm.DoDeleteAsync();

            return(FFResult().RefreshGrid());
        }
コード例 #10
0
 public IActionResult Edit(DataPrivilegeVM vm)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState.GetErrorJson()));
     }
     else
     {
         vm.DoEdit(false);
         if (!ModelState.IsValid)
         {
             return(BadRequest(ModelState.GetErrorJson()));
         }
         else
         {
             return(Ok(vm.Entity));
         }
     }
 }
コード例 #11
0
 public async Task<IActionResult> Edit(DataPrivilegeVM vm)
 {
     if (!ModelState.IsValid)
     {
         return BadRequest(ModelState.GetErrorJson());
     }
     else
     {
         await vm.DoEditAsync(false);
         if (!ModelState.IsValid)
         {
             return BadRequest(ModelState.GetErrorJson());
         }
         else
         {
             return Ok(vm.Entity);
         }
     }
 }
コード例 #12
0
        public async Task <IActionResult> Add(DataPrivilegeVM vm)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.GetErrorJson()));
            }
            else
            {
                await vm.DoAddAsync();

                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState.GetErrorJson()));
                }
                else
                {
                    return(Ok(vm.Entity));
                }
            }
        }