//[CustomAuthorizationFilterAttribute]
 public IHttpActionResult CreateRolePermission(CreateRolePermissionIn input)
 {
     if (ModelState.IsValid)
     {
         var role = new SystemManagement.Business.Controllers.Role();
         var createRolePermissionOut = role.CreateRolePermission(input);
         return(ResponseMessage(Request.CreateResponse(System.Net.HttpStatusCode.OK, createRolePermissionOut)));
     }
     else
     {
         var output = new CreateRoleOut();
         output.result  = SystemManagement.Entities.Common.Result.Error;
         output.message = DetailErrorBadRequest(ModelState);
         return(ResponseMessage(Request.CreateResponse(System.Net.HttpStatusCode.BadRequest, output)));
     }
 }
Пример #2
0
        public CreateRolePermissionOut CreateRolePermission(CreateRolePermissionIn input)
        {
            CreateRolePermissionOut output = new CreateRolePermissionOut()
            {
                result = Entities.Common.Result.Error
            };

            using (var dataContext = DataContextHelper.GetDataContext <RoleDataContext>())
            {
                var linqResult = dataContext.spr_setRolePermission(input.rolePermission.rl_code,
                                                                   input.rolePermission.pm_code,
                                                                   input.rolePermission.rp_creationUser);
                if (linqResult > 0)
                {
                    output.rpID   = linqResult;
                    output.result = Entities.Common.Result.Success;
                }
            }
            return(output);
        }
Пример #3
0
        public CreateRolePermissionOut CreateRolePermission(CreateRolePermissionIn input)
        {
            var output = new CreateRolePermissionOut()
            {
                result = Entities.Common.Result.Error
            };
            var listresult = new List <MethodParameters.Controllers.SystemManagementApi.Role.CreateRolePermissionOut.CreateRolePermission>();
            var request    = new Business.Role.Role();

            foreach (var item in input.listRolePermission)
            {
                var createRoletOut = request.CreateRolePermission(new MethodParameters.Role.CreateRolePermissionIn()
                {
                    rolePermission = new Entities.Database.RolePermission()
                    {
                        rl_code         = item.rl_code,
                        pm_code         = item.pm_code,
                        rp_creationUser = item.rp_creationUser
                    }
                });

                if (createRoletOut.result != Entities.Common.Result.Success)
                {
                    MethodParameters.Controllers.SystemManagementApi.Role.CreateRolePermissionOut.CreateRolePermission result = null;
                    result.rpID   = createRoletOut.rpID;
                    result.deatil = createRoletOut.result;
                    listresult.Add(result);
                }


                if (listresult.Count() == 0)
                {
                    output.result = Entities.Common.Result.Success;
                }
            }
            return(output);
        }
Пример #4
0
        public CreateRolePermissionOut CreateRolePermission(CreateRolePermissionIn input)
        {
            var rolePermission = new SystemManagement.DataAccess.Role.Role();

            return(rolePermission.CreateRolePermission(input));
        }