Ejemplo n.º 1
0
        public async Task <IActionResult> GetById(int id)
        {
            var currentUser = await GetCurrentUserAsync();

            if (currentUser is null ||
                currentUser is default(User))
            {
                return(Unauthorized("No authorized user found.\nPlease log in by using your credentials."));
            }

            if (id <= 0)
            {
                return(BadRequest("Id value must be greater than zero."));
            }

            var log = await _activityLogService.GetActivityLogByIdAsync(id, currentUser.Id);

            if (log is null ||
                log is default(ActivityLog))
            {
                return(NotFound("ActivityLog not found."));
            }

            return(Ok(log));
        }