public async Task <ActionResult <UserInfoWithHoursWorkedDto> > GetAllUserTimestamps([FromQuery] TimestampParameters timestampParameters) { try { //get current user var user = await _userRepository.GetUser(_userAccessor.GetCurrentUsername()); //Get timestamps by date for the user var filteredTimestamps = await _timestampRepository.GetTimestampsForUserByDate(user, timestampParameters); user.Timestamps = filteredTimestamps; //Create MetaData var metadata = new { filteredTimestamps.TotalCount, filteredTimestamps.PageSize, filteredTimestamps.CurrentPage, filteredTimestamps.HasNext, filteredTimestamps.HasPrevious }; //Add metadata to header Response.Headers.Add("X-Pagination", JsonConvert.SerializeObject(metadata)); var userWithTimestamps = _mapper.Map <UserInfoWithHoursWorkedDto>(user); return(Ok(userWithTimestamps)); } catch (Exception) { return(this.StatusCode(StatusCodes.Status500InternalServerError, "Server Error: Failed to retrieve user data")); } }