예제 #1
0
        public RoleEntity Get(int roleId)
        {
            var roleEntity = roleServices.GetRoleById(roleId);

            if (roleEntity != null)
            {
                return(roleEntity);
            }
            return(null);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
 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..."
           };
 }
예제 #5
0
 public JsonResult getRoleById(string id)
 {
     return(Json(_roleServices.GetRoleById(id), JsonRequestBehavior.AllowGet));
 }