public RoleEntity Get(int roleId) { var roleEntity = roleServices.GetRoleById(roleId); if (roleEntity != null) { return(roleEntity); } return(null); }
public RoleViewModel Get(int roleId) { var roleEntity = roleServices.GetRoleById(roleId); if (roleEntity != null) { Mapper.Initialize(cfg => cfg.CreateMap <RoleEntity, RoleViewModel>()); var role = Mapper.Map <RoleEntity, RoleViewModel>(roleEntity); return(role); } return(null); }
public async Task <MessageModel <RoleDto> > Get(int id) { var data = new MessageModel <RoleDto>(); var role = await _roleServices.GetRoleById(id); if (role != null) { data.data = role; data.success = true; data.msg = "获取成功"; } return(data); }
public HttpResponseMessage GetById(int id) { if (id != 0) { var Role = _roleServices.GetRoleById(id); if (Role != null) { return(Request.CreateResponse(HttpStatusCode.OK, Role)); } throw new ApiDataException(1001, "No product found for this id.", HttpStatusCode.NotFound); } throw new ApiException() { ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = "Bad Request..." }; }
public JsonResult getRoleById(string id) { return(Json(_roleServices.GetRoleById(id), JsonRequestBehavior.AllowGet)); }