public IActionResult UpdateEpisodeStatus(string id, [FromBody] AddToHistory model) { if (!VerifyThatShowIsEpisode(id, out var episodeInfo, out var result)) { return(result); } _watchlistService.SetStatus(CurrentUserId, episodeInfo, model.WatchStatus); return(Ok()); }
public async Task <IActionResult> UpdateShowStatus(string id, [FromBody] AddToHistory model) { var show = await _omdbApi.GetById(id); if (show.Type == ShowType.Episode) { return(UpdateEpisodeStatus(id, model)); } _watchlistService.SetStatus(CurrentUserId, id, model.WatchStatus); return(Ok(_watchlistService.GetStatusForShow(CurrentUserId, id))); }
public IActionResult AddEpisodeToWatching(string id, [FromBody] AddToHistory model) { if (!VerifyThatShowIsEpisode(id, out var episodeInfo, out var result)) { return(result); } var existingStatus = _watchlistService.GetStatusForEpisode(CurrentUserId, id); if (existingStatus == WatchStatus.InProgress || existingStatus == WatchStatus.Completed) { return(BadRequest("The episode is already in progress or completed.")); } _watchlistService.AddToHistory(CurrentUserId, episodeInfo, model.WatchStatus); return(Ok()); }
public async Task <IActionResult> AddToWatching(string id, [FromBody] AddToHistory model) { var show = await _omdbApi.GetById(id); if (show.Type == ShowType.Episode) { return(AddEpisodeToWatching(id, model)); } var existingStatus = _watchlistService.GetStatusForShow(CurrentUserId, id); if (existingStatus == WatchStatus.InProgress || existingStatus == WatchStatus.Completed) { return(BadRequest("The show is already in progress or completed.")); } _watchlistService.AddToHistory(CurrentUserId, id, model.WatchStatus); return(Ok(_watchlistService.GetStatusForShow(CurrentUserId, id))); }