public static void AddTypeCost(string TypeCostName, bool Service, bool Repair) { var TypeCost = new TypeCost { typeCostName = TypeCostName, service = Service, repair = Repair }; using (var db = new trafficEntities()) { db.TypeCost.Add(TypeCost); db.SaveChanges(); } }
public MaintenanceClass(long MaintenanceID) { maintenanceID = MaintenanceID; Maintenance _maintenance = MaintenanceLogic.SearchByID(maintenanceID); transportID = _maintenance.transportID; dateFrom = _maintenance.dateFrom; dateUntil = _maintenance.dateUntil; cost = (decimal)_maintenance.cost; TypeCost TC = TypeCostLogic.SearchByID(_maintenance.typeCostID); service = (bool)TC.service; repair = (bool)TC.repair; }
public static TypeCost SearchByID(long TypeCostID) { TypeCost TC = new TypeCost(); using (var db = new trafficEntities()) { //finding TypeCost var queryTypeCost = from tc in db.TypeCost where tc.typeCostID == TypeCostID select tc; foreach (var tc in queryTypeCost) { TC = tc; } } return(TC); }