public bool Delete(int Id) { bool isDelete = true; try { dr = db.DrayageRate.Find(Id); db.DrayageRate.Remove(dr); db.SaveChanges(); } catch (Exception) { isDelete = false; } return(isDelete); }
public bool Update(int Id, int drayageSchemID, DateTime fromDate, DateTime toDate, decimal rate, string rateType) { bool isSave = true; try { dr = db.DrayageRate.Find(Id); dr.DrayageRateId = Id; dr.DrayageSchemeId = drayageSchemID; dr.FromDate = fromDate.Date; dr.ToDate = toDate.Date; dr.Rate = rate; dr.RateType = rateType; db.DrayageRate.AddOrUpdate(dr); db.SaveChanges(); } catch (Exception) { isSave = false; } return(isSave); }