private void ValidateUserCanDeleteRequest(MovieRequestRow request, ValidationContext resultContext) { if (request != null && !request.UserId.Equals(_claimsUserAccessor.UserId)) { resultContext.AddError("Unable to delete request", "Forbidden access to protected resource."); } }
private async Task CreateRequest(CreateMovieRequestCommand request, MovieDetails movieDetail, ExternalIds externalIds) { var newRequest = new MovieRequestRow { UserId = _claimsPrincipalAccessor.UserId, Title = movieDetail.Title, AirDateUtc = DateTime.Parse(movieDetail.Release_Date), ImagePath = movieDetail.Poster_Path, TheMovieDbId = request.TheMovieDbId }; newRequest.MovieRequestAgents.Add(new MovieRequestAgentRow(AgentTypes.TheMovieDb, request.TheMovieDbId.ToString())); if (!string.IsNullOrEmpty(externalIds.Imdb_Id)) { newRequest.MovieRequestAgents.Add(new MovieRequestAgentRow(AgentTypes.Imdb, externalIds.Imdb_Id)); } await _requestService.Add(newRequest); }
private void GivenARequestIsFoundWithStatus(RequestStatuses status) { _requestToUpdate = new MovieRequestRowBuilder().WithRequestStatus(status).Build(); _requestService.GetRequestById(Arg.Any <int>()).Returns(_requestToUpdate); }
public async Task Add(MovieRequestRow request) { await _requestRepository.Add(request); }
public async Task Add(MovieRequestRow request) { await base.Add(request); }
private void GivenARequestIsFound() { _request = new MovieRequestRowBuilder().Build(); _requestService.GetRequestById(Arg.Any <int>()).Returns(_request); }
private void GivenARequestIsCreated() { _requestService.Add(Arg.Do <MovieRequestRow>(x => _createdRequest = x)); }
private void GivenRequestAlreadyExists() { _request = new MovieRequestRowBuilder().Build(); _requestService.GetExistingRequest(Arg.Any <AgentTypes>(), Arg.Any <string>()).Returns(_request); }