Example #1
0
        public async Task <IActionResult> EditSeanceAsync(UpsertSeanceRequest request)
        {
            if (!await _seanceService.CheckId(request.Id))
            {
                return(BadRequest());
            }

            try
            {
                IReadOnlyCollection <ServicePriceModel> services = request.Services.Adapt <IReadOnlyCollection <ServicePriceModel> >();

                IReadOnlyCollection <SeatPriceModel> seatPrices = request.SeatPrices.Adapt <IReadOnlyCollection <SeatPriceModel> >();

                SeanceModel seanceModel = new SeanceModel(
                    request.Id,
                    request.DateTime,
                    request.FilmId,
                    request.HallId,
                    services,
                    seatPrices
                    );

                await _seanceService.UpsertSeanceAsync(seanceModel);

                return(NoContent());
            }
            catch (Exception e)
            {
                return(Conflict(e.Message));
            }
        }