public IActionResult CreateCinema([FromBody] CinemaUpsertDto cinemaDto) { if (cinemaDto == null) { return(BadRequest(ModelState)); } if (cinemaRepository.CinemaExists(cinemaDto.CinemaName)) { ModelState.AddModelError("", "Kino vec postoji"); return(StatusCode(404, ModelState)); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var obj = mapper.Map <Cinema>(cinemaDto); if (!cinemaRepository.CreateCinema(obj)) { ModelState.AddModelError("", $"Nesto je pogresno u spremanju {obj.CinemaName}"); return(StatusCode(500, ModelState)); } return(CreatedAtRoute("GetCinema", new { id = obj.CinemaId }, obj)); }