public IActionResult PostCinema([FromBody] Cinemas cinemas) { if (cinemas == null) { return(BadRequest()); } _cinemaService.CreateCinema(cinemas); return(Ok(cinemas)); }
public IActionResult CreateCinema([FromBody] CinemaInfo cinemaInfo) { ResultCreated result = сinemaService.CreateCinema(cinemaInfo); if (result.ResultOk) { return(Created($"api/cinemas/{result.Id}", typeof(Cinema))); } return(BadRequest(result)); }
public IActionResult CreateCinema([FromBody] CinemaView cinema) { if (_сinemaService.CheckCinemaExists(cinema)) { return(BadRequest(new Response(ErrorOfCinemaExistence))); } if (!ModelState.IsValid) { return(BadRequest(new Response(ModelState))); } int id = _сinemaService.CreateCinema(cinema); var response = new CreateResponse(id); return(CreatedAtAction(nameof(GetCinema), new { id = response.Id }, response)); }