Beispiel #1
0
 public void AddNewRent(CarSharing.Model.Car car, CarSharing.Model.City city, CarSharing.Model.User user)
 {
     CarSharing.Model.CarRental carRental = new CarSharing.Model.CarRental()
     {
         CarId         = car.IdCar,
         CityId        = city.IdCity,
         UserId        = user.IdUsers,
         DateTimeStart = DateTime.Now
     };
     carShaeringEntities.CarRentals.Add(carRental);
     Model.SaveChanges();
 }
Beispiel #2
0
        public List <CarSharing.Model.RentCarForUser> getListRentForUser(CarSharing.Model.User user)
        {
            List <CarSharing.Model.RentCarForUser> rentCarForUsers = carShaeringEntities.CarRentals.Where(i => i.UserId == user.IdUsers).Select(i => new CarSharing.Model.RentCarForUser()
            {
                CarRental           = i,
                PriceInMinuteDollar = i.Car.TypeOfCar1.PriceInMinute + i.City.PriceInMinute
            }).ToList();

            rentCarForUsers.ForEach(i => i.CarRental.DateTimeStart.ToString());

            return(rentCarForUsers);
        }
Beispiel #3
0
        public bool AuthUser(string login, string password)
        {
            var user = carShaeringEntities.Users.Where(i => login == i.Email && password == i.Password);

            if (user.Count() > 0)
            {
                AuthorizedUser = user.FirstOrDefault();
                return(true);
            }

            SharedClass.MessageBoxWarning("Неправильный логин или пароль");

            return(false);
        }