public IHttpActionResult UpdateRolePermission(UpdateRolePermissionIn input)
 {
     if (ModelState.IsValid)
     {
         var role = new SystemManagement.Business.Controllers.Role();
         var updateRolePermissionOut = role.UpdateRolePermission(input);
         return(ResponseMessage(Request.CreateResponse(System.Net.HttpStatusCode.OK, updateRolePermissionOut)));
     }
     else
     {
         var output = new UpdateRolePermissionOut();
         output.result  = SystemManagement.Entities.Common.Result.Error;
         output.message = DetailErrorBadRequest(ModelState);
         return(ResponseMessage(Request.CreateResponse(System.Net.HttpStatusCode.BadRequest, output)));
     }
 }
        public UpdateRolePermissionOut UpdateRolePermission(UpdateRolePermissionIn input)
        {
            var output = new UpdateRolePermissionOut()
            {
                result = Entities.Common.Result.Error
            };
            var request    = new Business.Role.Role();
            var listresult = new List <MethodParameters.Controllers.SystemManagementApi.Role.UpdateRolePermissionOut.ResultUpdateRolePermission>();

            foreach (var item in input.listRolePermission)
            {
                var updateRolePermissionOut = request.UpdateRolePermission(new MethodParameters.Role.UpdateRolePermissionIn()
                {
                    rolePermission = new Entities.Database.RolePermission()
                    {
                        rpID                = item.rpID,
                        rl_code             = item.rl_code,
                        pm_code             = item.pm_code,
                        rp_modificationUser = item.rp_modificationUser,
                        rp_status           = item.rp_status
                    }
                });

                if (updateRolePermissionOut.result != Entities.Common.Result.Success)
                {
                    MethodParameters.Controllers.SystemManagementApi.Role.UpdateRolePermissionOut.ResultUpdateRolePermission result = null;
                    result.rpID   = updateRolePermissionOut.rpID;
                    result.deatil = updateRolePermissionOut.result;
                    listresult.Add(result);
                }
            }

            if (listresult.Count() == 0)
            {
                output.result = Entities.Common.Result.Success;
            }

            return(output);
        }
        public UpdateRolePermissionOut UpdateRolePermission(UpdateRolePermissionIn input)
        {
            UpdateRolePermissionOut output = new UpdateRolePermissionOut()
            {
                result = Entities.Common.Result.Error
            };

            using (var dataContext = DataContextHelper.GetDataContext <RoleDataContext>())
            {
                var linqResult = dataContext.spr_updateRolePermission(
                    input.rolePermission.rpID
                    , input.rolePermission.rl_code
                    , input.rolePermission.pm_code
                    , input.rolePermission.rp_modificationUser
                    , input.rolePermission.rp_status
                    );
                if (linqResult == 1)
                {
                    output.rpID   = linqResult;
                    output.result = Entities.Common.Result.Success;
                }
            }
            return(output);
        }
Example #4
0
        public UpdateRolePermissionOut UpdateRolePermission(UpdateRolePermissionIn input)
        {
            var permission = new SystemManagement.DataAccess.Role.Role();

            return(permission.UpdateRolePermission(input));
        }