Пример #1
0
        static void Main(string[] args)
        {
            CarRentalServicesDBContext _context = new CarRentalServicesDBContext();



            //var car = new Car{
            //    Brand = "Tesla",
            //    Model = "X",
            //    Year = 2016,
            //    Regnumber = "test"
            //};
            //var addCar = carMethods.AddCar(car);
            //_context.SaveChanges();



            var cust = new Customer {
                FirstName = "Ramin", LastName = "Runesson", Phone = "0703454545", Email = "*****@*****.**"
            };

            methods.ChangeCustomer(cust);
            List <Customer> customers = methods.GetAllCustomers();

            foreach (Customer c in customers)
            {
                Write(c.FirstName);
            }
            ReadKey();
        }
        public string UpdateCustomer(string id, string firstname, string lastname, string phone, string email)
        {
            Customer customer = new Customer();

            customer.Id        = Convert.ToInt32(id);
            customer.FirstName = firstname;
            customer.LastName  = lastname;
            customer.Phone     = phone;
            customer.Email     = email;
            try
            {
                customerMethods.ChangeCustomer(customer);
                return("Everything's gonna be alright!");
            }
            catch
            {
                return("Nothing's gonna be alright!:(");
            }
        }
 public void  ChangeCustomer(Customer customer)
 {
     castomerMethods.ChangeCustomer(customer);
 }