コード例 #1
0
        public SearchDataResponse SearchData()
        {
            var result = new SearchDataResponse
            {
                ListBookings      = DayaxeDbContext.Bookings.OrderByDescending(x => x.BookingId).ToList(),
                ListCustomerInfos = CustomerInfoList.Where(c => !c.IsDelete).ToList()
            };

            result.ListBookings.ForEach(booking =>
            {
                var product = ProductList.FirstOrDefault(p => p.ProductId == booking.ProductId);
                var hotel   = HotelList.FirstOrDefault(h => h.HotelId == (product != null ? product.HotelId : 0));

                booking.BookingsTypeString = product != null ? GetProductType(product.ProductType) : string.Empty;
                booking.TimeZoneId         = hotel != null ? hotel.TimeZoneId : string.Empty;
            });

            result.ListCustomerInfos.ForEach(customer =>
            {
                var discount = GetSubscriptionDiscount(customer.CustomerId);
                if (discount != null)
                {
                    customer.SubscriptionCode = discount.Code;
                }
            });

            return(result);
        }
コード例 #2
0
        public SearchDataResponse SearchDataByCustomerId(int customerId)
        {
            var result = new SearchDataResponse
            {
                ListBookings      = BookingList.Where(b => b.CustomerId == customerId).OrderByDescending(x => x.BookingId).ToList(),
                ListCustomerInfos = new List <CustomerInfos>()
            };

            result.ListBookings.ForEach(booking =>
            {
                var product = ProductList.FirstOrDefault(p => p.ProductId == booking.ProductId);
                booking.BookingsTypeString = product != null ? GetProductType(product.ProductType) : string.Empty;
            });

            return(result);
        }