Пример #1
0
        private void ProcessRequestGuestData(IEnumerable <Guest> requestGuests, DataOP op)
        {
            if (requestGuests == null)
            {
                return;
            }

            foreach (Guest g in requestGuests)
            {
                if (DataOP.AddNew == op)
                {
                    g.RequestHeaderId = RequestHeader.Id;
                    _guestReposity.Add(g);
                }

                if (DataOP.DEL == op)
                {
                    var user = _guestReposity.GetById(g.Id);
                    _guestReposity.Delete(user);
                }

                if (DataOP.EDIT == op)
                {
                    _guestReposity.Update(g);
                }
            }
        }
Пример #2
0
        public bool DeleteGuest(Guest guest)
        {
            if (guest == null || _guestRepository.GetById(guest.GuestIdDetails()) == null || guest.OutstandingChargesDetails() > 0)
            {
                return(false);
            }

            // Delete all facility reservations made by guest
            IList <FacilityReservation> facilityReservations = _facilityReservationRepository.GetByReserveeId(guest.GuestIdDetails()).ToList();

            foreach (var facilityReservation in facilityReservations)
            {
                _facilityReservationRepository.Delete(facilityReservation);
            }

            _guestRepository.Delete(guest);
            return(true);
        }
Пример #3
0
        public async Task <GuestDto> GetById(long id)
        {
            var guest = await _iGuestRepository.GetById(id);

            return(GuestDtoMapper(guest));
        }