public Infrastructure.ApiResponse <Services.ViewModel.UserViewModel> Get(Guid id) { try{ Guid userid = id; Services.Message.GetUserRequest req = new Services.Message.GetUserRequest(); req.userid = userid; var user = _userService.GetUser(req).user; return(Infrastructure.ApiResponse <Services.ViewModel.UserViewModel> .CreateResponse(true, "", user)); }catch (Infrastructure.BusinessRuleException bex) { return(Infrastructure.ApiResponse <Services.ViewModel.UserViewModel> .CreateResponse(false, bex.Message, null, System.Net.HttpStatusCode.BadRequest, bex.BrokenRules)); }catch (Exception) { return(Infrastructure.ApiResponse <Services.ViewModel.UserViewModel> .CreateResponse(false, "Ocorreu um erro inesperado. Entre em contato com o nosso time de desenvolvimento.", null, System.Net.HttpStatusCode.InternalServerError)); } }
public Infrastructure.ApiResponse <Services.ViewModel.UserViewModel> GetInfo() { var id = getClaimValue("id"); try{ Guid userid = Guid.Empty; if (!Guid.TryParse(id, out userid)) { return(Infrastructure.ApiResponse <Services.ViewModel.UserViewModel> .CreateResponse(false, "Usuário não encontrado", null, System.Net.HttpStatusCode.NotFound)); } Services.Message.GetUserRequest req = new Services.Message.GetUserRequest(); req.userid = userid; var user = _userService.GetUser(req).user; return(Infrastructure.ApiResponse <Services.ViewModel.UserViewModel> .CreateResponse(true, "", user)); }catch (Infrastructure.BusinessRuleException bex) { return(Infrastructure.ApiResponse <Services.ViewModel.UserViewModel> .CreateResponse(false, bex.Message, null, System.Net.HttpStatusCode.BadRequest, bex.BrokenRules)); }catch (Exception) { return(Infrastructure.ApiResponse <Services.ViewModel.UserViewModel> .CreateResponse(false, "Ocorreu um erro inesperado. Entre em contato com o nosso time de desenvolvimento.", null, System.Net.HttpStatusCode.InternalServerError)); } }