示例#1
0
        public BaseResponse <VMUserResponse> Create([FromBody] VMCreateUserRequest vmRequest)
        {
            if (vmRequest == null)
            {
                return(BaseResponse <VMUserResponse> .SetError("Request body is empty"));
            }

            //try
            //{
            var result         = _userService.Create(vmRequest);
            var responseObject = VMUserListItem.ToResponse(result);
            var response       = BaseResponse <VMUserResponse> .SetResponse(responseObject);

            return(response);
            //}
            //catch (Exception exc)
            //{
            //    return BaseResponse<VMUserResponse>.SetError(exc);
            //}
        }
示例#2
0
        public BaseResponse <VMUserResponse> Update([FromBody] VMUpdateUserRequest vmRequest)
        {
            if (vmRequest == null)
            {
                return(BaseResponse <VMUserResponse> .SetError("Request body is empty"));
            }

            try
            {
                var result         = _userService.Update(vmRequest);
                var responseObject = VMUserListItem.ToResponse(result);
                var response       = BaseResponse <VMUserResponse> .SetResponse(responseObject);

                return(response);
            }
            catch (Exception exc)
            {
                return(BaseResponse <VMUserResponse> .SetError(exc));
            }
        }
示例#3
0
        public BaseResponse <VMUserResponse> Get(VMGetUserDetailsRequest vmRequest)
        {
            if (vmRequest == null)
            {
                return(BaseResponse <VMUserResponse> .SetError("Request body is empty"));
            }

            try
            {
                var result         = _userService.Get(vmRequest);
                var responseObject = VMUserListItem.ToResponse(result);
                var response       = BaseResponse <VMUserResponse> .SetResponse(responseObject);

                return(response);
            }
            catch (Exception exc)
            {
                return(BaseResponse <VMUserResponse> .SetError(exc));
            }
        }