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

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

            return(Response(result));
        }