コード例 #1
0
        private async void BindProperties(Vouchers voucher)
        {
            if (voucher != null)
            {
                Voucher = voucher;
            }

            Clients = await GetClients();

            Hotels = await GetHotels();

            RestTypes = await GetRestTypes();

            AdditionalServices = await GetAdditionalServices();

            Stuffs = await GetStuffs();

            PaymentStatuses = new List <string> {
                "Оплачено", "Не оплачено"
            };
            BookingStatuses = new List <string> {
                "Забронирован", "Не забронирован"
            };

            if (_handleType == HandleType.Add)
            {
                return;
            }
            Client        = Clients.FirstOrDefault(p => Voucher.ClientId == p.Id);
            Hotel         = Hotels.FirstOrDefault(p => Voucher.HotelId == p.Id);
            RestType      = RestTypes.FirstOrDefault(p => Voucher.RestTypeId == p.Id);
            Stuff         = Stuffs.FirstOrDefault(p => Voucher.StuffId == p.Id);
            PaymentStatus = Voucher.PaymentStatus;
            BookingStatus = Voucher.BookingStatus;
            StartDate     = Voucher.StartDate;
            EndDate       = Voucher.EndDate;

            AdditionalService1 = AdditionalServices.FirstOrDefault(p => Voucher.AdditService1Id == p.Id);
            AdditionalService2 = AdditionalServices.FirstOrDefault(p => Voucher.AdditService2Id == p.Id);
            AdditionalService3 = AdditionalServices.FirstOrDefault(p => Voucher.AdditService3Id == p.Id);
        }
コード例 #2
0
 public void Authorize(string login, string password, out Guest guest, out Hotel hotel)
 {
     guest = Guests.FirstOrDefault(g => g.Email == login && Hash.GetHash(g.Password) == Hash.GetHash(password));
     hotel = Hotels.FirstOrDefault(h => h.Email == login && Hash.GetHash(h.Password) == Hash.GetHash(password));
 }