public ActionResult <List <UserDTO> > Get() { try { return(Ok(_userApplicationService.Get())); } catch (Exception ex) { return(BadRequest(new { message = ex.GetExceptionMessage() })); } }
public IActionResult GetUser(Guid userId) { _logger.Info($"Event:{LoggingEvents.UserGet},Method:{nameof(GetUser)}, Message: find user with ID: {userId}"); var userFound = _userApplication.Get(userId).Data; if (userFound == null) { _logger.Warn($"Event:{LoggingEvents.UserGet},Method:{nameof(GetUser)}, Error: user with Id {userId} cannot be found."); return(NotFound()); } _logger.Info($"Event:{LoggingEvents.UserGet},Method:{nameof(GetUser)}, Message: user was found. PayLoad: {JsonConvert.SerializeObject(userFound)}"); return(Ok(CreateLink(userFound))); }
public IActionResult GetKeysByUser(Guid userId) { var userFound = _userApplication.Get(userId).Data; if (userFound == null) { return(NotFound()); } var keyInfoList = _userApplication.GetKeys(userId).Data; keyInfoList = keyInfoList.Select(key => { key = CreateLink(key); return(key); }); var wrapper = new LinkedCollectionWrapperDto <KeyInfoDto>(keyInfoList); return(Ok(CreateLink(wrapper))); }
public IActionResult Get(int id) { return(Ok(_userApplicationService.Get(id))); }
//[Authorize(Roles = "admin")] public Task <HttpResponseMessage> Get() { var users = _service.Get(); return(CreateResponse(HttpStatusCode.OK, users)); }
public IActionResult Get([FromQuery] Filter filter) { var result = _userApplicationService.Get(filter); return(Response(result)); }