Exemple #1
0
        public HotelReservationDto CreateHotelReservation(HotelReservationDto hotelReservationDto, int userId, int tenantId)
        {
            long ticks = DateTime.Now.Ticks;

            if (GetHotelReservation(hotelReservationDto.HotelReservationId, tenantId) != null)
            {
                return(EditHotelReservation(hotelReservationDto, userId, tenantId));
            }

            var hotelReservationObj = Mapper.Map <HotelReservation>(hotelReservationDto);

            hotelReservationObj.HotelId   = hotelReservationDto.HotelId;
            hotelReservationObj.TickectNo = ticks.ToString();
            hotelReservationObj.CheckIn   = hotelReservationDto.CheckIn;
            hotelReservationObj.CheckOut  = hotelReservationDto.CheckOut;
            hotelReservationObj.Adult     = hotelReservationDto.Adult;
            hotelReservationObj.Child     = hotelReservationDto.Child;
            hotelReservationObj.UserId    = hotelReservationDto.UserId;
            hotelReservationObj.RoomCount = hotelReservationDto.RoomCount;
            hotelReservationObj.Status    = (int)Enums.Status.New;

            hotelReservationObj.CreationTime  = Strings.CurrentDateTime;
            hotelReservationObj.CreatorUserId = hotelReservationDto.UserId;
            hotelReservationObj.TenantId      = tenantId;
            hotelReservationObj.SeenUserId    = 0;
            _hotelReservationService.Insert(hotelReservationObj);

            SaveChanges();
            hotelReservationDto.TickectNo = hotelReservationObj.TickectNo;
            return(hotelReservationDto);
        }