Exemple #1
0
        public async Task <IHttpActionResult> Create(CinemaCreationModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            ICinema cinema = await cinemaRepo.GetByNameAndAddressAsync(model.Name, model.Address);

            if (cinema == null)
            {
                await cinemaRepo.InsertAsync(new Cinema(model.Name, model.Address));

                return(Ok());
            }

            return(BadRequest("Cinema already exists"));
        }