Пример #1
0
        public static SeatType ToViewModel(this SeatTypeDTO dto)
        {
            if (dto == null) return null;

            var model = new SeatType();
            model.Id = dto.Id;
            model.Name = dto.Name;
            model.Description = dto.Description;
            model.Price = dto.Price;
            model.Quantity = dto.Quantity;
            return model;
        }
Пример #2
0
        public async Task<ActionResult> EditSeat(SeatType seat)
        {
            if (this._conference == null)
            {
                return HttpNotFound();
            }

            if (!ModelState.IsValid)
            {
                return PartialView(seat);
            }

            var command = seat.ToUpdateSeatTypeCommand(this._conference);
            var result = await ExecuteCommandAsync(command);

            if (!result.IsSuccess())
            {
                throw new InvalidOperationException(result.GetErrorMessage());
            }

            return PartialView("SeatGrid", new SeatType[] { seat });
        }