Exemplo n.º 1
0
 public ActionResult <List <UserDTO> > Get()
 {
     try
     {
         return(Ok(_userApplicationService.Get()));
     }
     catch (Exception ex)
     {
         return(BadRequest(new { message = ex.GetExceptionMessage() }));
     }
 }
Exemplo n.º 2
0
        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)));
        }
Exemplo n.º 3
0
        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)));
        }
Exemplo n.º 4
0
 public IActionResult Get(int id)
 {
     return(Ok(_userApplicationService.Get(id)));
 }
Exemplo n.º 5
0
        //[Authorize(Roles = "admin")]
        public Task <HttpResponseMessage> Get()
        {
            var users = _service.Get();

            return(CreateResponse(HttpStatusCode.OK, users));
        }
Exemplo n.º 6
0
        public IActionResult Get([FromQuery] Filter filter)
        {
            var result = _userApplicationService.Get(filter);

            return(Response(result));
        }