public IHttpActionResult GetRoleByCode(GetRoleByCodeIn input) { if (ModelState.IsValid) { var role = new SystemManagement.Business.Controllers.Role(); var getRoleByCodeOut = role.GetRoleByCode(input); return(ResponseMessage(Request.CreateResponse(System.Net.HttpStatusCode.OK, getRoleByCodeOut))); } else { var output = new GetRoleByCodeOut(); output.result = SystemManagement.Entities.Common.Result.Error; output.message = DetailErrorBadRequest(ModelState); return(ResponseMessage(Request.CreateResponse(System.Net.HttpStatusCode.BadRequest, output))); } }
public GetRoleByCodeOut GetRoleByCode(GetRoleByCodeIn input) { var output = new GetRoleByCodeOut() { result = Entities.Common.Result.Error }; var request = new Business.Role.Role(); var getRoleByCodeOut = request.GetRoleByCode(new MethodParameters.Role.GetRoleByCodeIn() { role = new Entities.Database.Role() { rl_code = input.rl_code } }); if (getRoleByCodeOut.result == Entities.Common.Result.Success) { output.result = Entities.Common.Result.Success; } return(output); }
public GetRoleByCodeOut GetRoleByCode(GetRoleByCodeIn input) { GetRoleByCodeOut output = new GetRoleByCodeOut() { result = Entities.Common.Result.Error }; using (var dataContext = DataContextHelper.GetDataContext <RoleDataContext>()) { var linqResult = dataContext.spr_getRoleByCode(input.role.rl_code); if (linqResult.Count() > 0) { foreach (var item in linqResult) { var role = new Entities.Database.Role() { rlID = item.rlID, rl_code = item.rl_code, rl_name = item.rl_name, rl_creationUser = item.rl_creationUser, rl_creationDate = item.rl_creationDate, rl_modificationUser = item.rl_modificationUser, rl_modificationDate = item.rl_modificationDate, rl_status = item.rl_status }; output.listRole.Add(role); } output.result = Entities.Common.Result.Success; } else { output.result = Entities.Common.Result.NoRecords; } } return(output); }
public GetRoleByCodeOut GetRoleByCode(GetRoleByCodeIn input) { var permission = new SystemManagement.DataAccess.Role.Role(); return(permission.GetRoleByCode(input)); }