Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public HallModel Get(Guid id)
        {
            Hall      hall  = _hallRepository.Get(id);
            HallModel model = Mapper.Map <HallModel>(hall);

            model.Features = _hallRepository.GetFeatures(hall.Id).Select(f => Mapper.Map <FeatureModel>(f)).ToList();
            return(model);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public Guid Add(ReservationModel model)
        {
            Reservation reservation = Mapper.Map <Reservation>(model);

            reservation.Hall     = _hallRepository.Get(model.HallId);
            reservation.Customer = _customerRepository.Get(model.CustomerId);

            string errors = Validate(reservation);

            if (errors != null)
            {
                throw new ValidationException(errors);
            }

            _reservationRepository.Insert(reservation);
            return(reservation.Id);
        }