public bool Delete(int TruckDriverCompanyId) { bool isDelete = true; try { tdc = db.TruckDriverCompany.Find(TruckDriverCompanyId); db.TruckDriverCompany.Remove(tdc); db.SaveChanges(); } catch (Exception) { isDelete = false; } return(isDelete); }
public bool Update(int TruckDriverCompanyId, int TruckDriverId, int CompanyId) { bool isSave = true; try { tdc = db.TruckDriverCompany.Find(TruckDriverCompanyId); tdc.TruckDriverId = TruckDriverId; tdc.CompanyId = CompanyId; db.TruckDriverCompany.AddOrUpdate(tdc); db.SaveChanges(); } catch (Exception e) { e.ToString(); isSave = false; } return(isSave); }