public async Task AddFilmProductionAsync(AddUserFilmProductionModel addUserFilmProductionModel, string userId) { if (await _userFilmProductionsRepository.IsFilmProductionAddedAsync(addUserFilmProductionModel.FilmProductionId, userId)) { throw new HttpStatusCodeException(HttpStatusCode.BadRequest, "Film jest już na twojej liście."); } else { await _userFilmProductionsRepository.AddFilmProductionAsync(addUserFilmProductionModel, userId); } }
public async Task AddFilmProductionAsync(AddUserFilmProductionModel addUserFilmProductionModel, string userId) { await _mySerialListDBContext.WatchingFilmProductionStatuses.AddAsync(new WatchingFilmProductionStatus { FilmProductionId = addUserFilmProductionModel.FilmProductionId, WatchingStatus = addUserFilmProductionModel.WatchingStatus, UserId = userId, Episodes = addUserFilmProductionModel.Episodes ?? 1 }); await _mySerialListDBContext.SaveChangesAsync(); }
public async Task <ActionResult> AddFilmProductionAsync([FromBody] AddUserFilmProductionModel addUserFilmProductionModel) { await _userFilmProductionsService.AddFilmProductionAsync(addUserFilmProductionModel, User.Identity.Name); return(Ok()); }