public async Task <IActionResult> UpdateStory([FromBody] RequestStoryDTO storyDTO)
        {
            string userId = HttpContext.User.Claims.FirstOrDefault(c => c.Type == System.Security.Claims.ClaimTypes.Sid).Value;

            DBStatus status = await storiesService.ReplaceStoryAsync(storyDTO, userId);

            ResponseStatusDTO responseStatusDTO = new ResponseStatusDTO((int)status, status.ToString());

            if (status == DBStatus.NotFound)
            {
                return(NotFound());
            }
            else if (status == DBStatus.Forbidden)
            {
                return(Forbid());
            }
            else if (status == DBStatus.NotModified)
            {
                return(BadRequest(new BadResponseDTO {
                    Status = (int)status, Errors = new Errors {
                        Message = new List <string> {
                            status.ToString()
                        }
                    }
                }));
            }
            else if (status == DBStatus.PreconditionFailed)
            {
                return(StatusCode(StatusCodes.Status412PreconditionFailed));
            }
            else
            {
                return(Ok(responseStatusDTO));
            }
        }
        public async Task <IActionResult> Register([FromBody] UserRegistrationDTO userRegistrationDTO)
        {
            DBStatus status = await authService.RegisterAsync(userRegistrationDTO);

            ResponseStatusDTO responseStatusDTO = new ResponseStatusDTO((int)status, status.ToString());

            if (status == DBStatus.Failed)
            {
                return(BadRequest(new BadResponseDTO {
                    Status = (int)status, Errors = new Errors {
                        Message = new List <string> {
                            status.ToString()
                        }
                    }
                }));
            }
            else if (status == DBStatus.Taken)
            {
                return(BadRequest(new BadResponseDTO {
                    Status = (int)status, Errors = new Errors {
                        Message = new List <string> {
                            "User Id already taken"
                        }
                    }
                }));
            }
            return(Ok(responseStatusDTO));
        }
        public async Task <IActionResult> RemoveStory([Required] Guid storyId)
        {
            string   userId = HttpContext.User.Claims.FirstOrDefault(c => c.Type == System.Security.Claims.ClaimTypes.Sid).Value;
            DBStatus status = await storiesService.RemoveStoryAsync(storyId, userId);

            ResponseStatusDTO responseStatusDTO = new ResponseStatusDTO((int)status, status.ToString());

            if (status == DBStatus.NotFound)
            {
                return(NotFound());
            }
            else if (status == DBStatus.Forbidden)
            {
                return(StatusCode(StatusCodes.Status403Forbidden));
            }
            else if (status == DBStatus.NotDeleted)
            {
                return(BadRequest(new BadResponseDTO {
                    Status = (int)status, Errors = new Errors {
                        Message = new List <string> {
                            status.ToString()
                        }
                    }
                }));
            }
            else
            {
                return(Ok(responseStatusDTO));
            }
        }
        public async Task <IActionResult> UpdateUserPassword([FromBody] UpdateUserPasswordDTO updateUserPasswordDTO)
        {
            string userId = HttpContext.User.Claims.FirstOrDefault(c => c.Type == System.Security.Claims.ClaimTypes.Sid).Value;

            updateUserPasswordDTO.UserId = userId;
            DBStatus status = await userService.UpdateUserPasswordAsync(updateUserPasswordDTO);

            ResponseStatusDTO responseStatusDTO = new ResponseStatusDTO((int)status, status.ToString());

            if (status == DBStatus.NotFound)
            {
                return(NotFound());
            }
            else if (status == DBStatus.Forbidden)
            {
                return(Forbid());
            }
            else if (status == DBStatus.NotModified)
            {
                return(BadRequest(new BadResponseDTO {
                    Status = (int)status, Errors = new Errors {
                        Message = new List <string> {
                            status.ToString()
                        }
                    }
                }));
            }
            else
            {
                return(Ok(responseStatusDTO));
            }
        }
        public async Task <IActionResult> CreateStory([FromBody] RequestStoryDTO storyDTO)
        {
            string   userId = HttpContext.User.Claims.FirstOrDefault(c => c.Type == System.Security.Claims.ClaimTypes.Sid).Value;
            DBStatus status = await storiesService.CreateStoryAsync(storyDTO, userId);

            ResponseStatusDTO responseStatusDTO = new ResponseStatusDTO((int)status, status.ToString());

            if (status == DBStatus.Failed)
            {
                return(BadRequest(new BadResponseDTO {
                    Status = (int)status, Errors = new Errors {
                        Message = new List <string> {
                            status.ToString()
                        }
                    }
                }));
            }
            else
            {
                return(CreatedAtAction(nameof(GetStory), new { storyId = storyDTO.StoryId }, null));
            }
        }