public List<Car> GetCars() { List<Car> retVal = new List<Car>(); var cl = objContext.Cars; foreach (var row in cl) { var c = new Car() { Car_Id = row.Car_Id, Car_Initial = row.Car_Initial, Car_Number = row.Car_Number, Car_Type = row.Car_Type, Car_Length = row.Car_Length, Car_Status = row.Car_Status }; retVal.Add(c); } return retVal; }
public void UpdateCars(int Id, Car obj) { var CarList = objContext.Cars.ToList(); var CarInfo = (from Cr in CarList where Cr.Car_Id == Id select Cr).First(); CarInfo.Car_Initial = obj.Car_Initial; CarInfo.Car_Number = obj.Car_Number; CarInfo.Car_Type = obj.Car_Type; CarInfo.Car_Length = obj.Car_Length; CarInfo.Car_Status = obj.Car_Status; objContext.SaveChanges(); }