using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using _4s_AutoDAL;
namespace _4s_AutoBLL
{
public class CustomerCar
{
public List<Customer_Car> GetAllCar()
{
_4s_AutoDataContext auto = new _4s_AutoDataContext();
return auto.Customer_Cars.ToList<Customer_Car>();
}
public void InsertCar(string Car_ID,int Customer_ID,string Car_Type,float Car_Displacement,DateTime Car_BuyTime,int Car_Mil)
{
Customer_Car car = new Customer_Car();
car.Car_ID = Car_ID;
car.Customer_ID = Customer_ID;
car.Car_Type = Car_Type;
car.Car_Displacement = Car_Displacement;
car.Car_BuyTime = Car_BuyTime;
car.Car_Mil = Car_Mil;
_4s_AutoDataContext auto = new _4s_AutoDataContext();
auto.Customer_Cars.InsertOnSubmit(car);
auto.SubmitChanges();
}
public void UpdateCar(int ID, int Customer_ID, float Car_Displacement, int Car_Mil)
{
_4s_AutoDataContext auto = new _4s_AutoDataContext();
Customer_Car car = auto.Customer_Cars.SingleOrDefault(c => c.ID == ID);
car.Customer_ID = Customer_ID;
car.Car_Displacement = Car_Displacement;
car.Car_Mil = Car_Mil;
auto.SubmitChanges();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using _4s_AutoDAL;
namespace _4s_AutoBLL
{
public class CustomerCar
{
public List<Customer_Car> GetAllCar()
{
_4s_AutoDataContext auto = new _4s_AutoDataContext();
return auto.Customer_Cars.ToList<Customer_Car>();
}
public void InsertCar(string Car_ID,int Customer_ID,string Car_Type,float Car_Displacement,DateTime Car_BuyTime,int Car_Mil)
{
Customer_Car car = new Customer_Car();
car.Car_ID = Car_ID;
car.Customer_ID = Customer_ID;
car.Car_Type = Car_Type;
car.Car_Displacement = Car_Displacement;
car.Car_BuyTime = Car_BuyTime;
car.Car_Mil = Car_Mil;
_4s_AutoDataContext auto = new _4s_AutoDataContext();
auto.Customer_Cars.InsertOnSubmit(car);
auto.SubmitChanges();
}
public void UpdateCar(int ID, int Customer_ID, float Car_Displacement, int Car_Mil)
{
_4s_AutoDataContext auto = new _4s_AutoDataContext();
Customer_Car car = auto.Customer_Cars.SingleOrDefault(c => c.ID == ID);
car.Customer_ID = Customer_ID;
car.Car_Displacement = Car_Displacement;
car.Car_Mil = Car_Mil;
auto.SubmitChanges();
}
}
}