public async Task <ActionResult> Post(CreateCinemaRequest model) { Guid cinemaId = Guid.NewGuid(); await _cinemaService.Add(cinemaId, model); return(CreatedAtRoute(nameof(GetCinemaById), new { id = cinemaId }, cinemaId)); }
public async Task Add(Guid id, CreateCinemaRequest request) { Cinema cinema = CinemaFactory.Create(id, request.Name, request.City); _ctx.Add(cinema); await _ctx.SaveChangesAsync(); }
public async Task <IActionResult> CreateAsync(CreateCinemaRequest request, CancellationToken token) { _logger.LogInformation("POST /cinema request accepted"); var response = await _cinemaService.CreateAsync(_mapper.Map <CinemaDTO>(request)); return(Ok(_mapper.Map <CinemaResponse>(response))); }
public async Task GivenCinemaInIsDefined(string cinema, string city) { CreateCinemaRequest request = new CreateCinemaRequest() { Name = cinema, City = city }; HttpResponseMessage response = await Client.PostAsJsonAsync("/api/cinemas/", request); _createdCinemaId = GetGuidFromLocationHeader(response); }
public ActionResult CreateCinema([FromBody] CreateCinemaRequest cinema) { //if (!ActiveStatus.ActiveUser.IsAdmin) // return this.BadRequest(); try { this.cinemaService.Add(cinema.Caption, cinema.Address, cinema.CinemaNetworkId, cinema.City, cinema.Description, cinema.Email, cinema.PhoneNumber); } catch (Exception exception) { return(this.BadRequest(exception.Message)); } return(this.Ok(cinema)); }