public bool removeSchedulePlan(SchedulePlan schedulePlan) { DAL.SchedulePlan entity = db.SchedulePlan.Where(v => v.id == schedulePlan.id).FirstOrDefault(); if (entity == null) { return(false); } // entity.boatToursManagerId = null; db.SaveChanges(); return(this.schedulePlans.Remove(schedulePlan)); }
public bool addSchedulePlan(SchedulePlan schedulePlan) { if (this.schedulePlans.Contains(schedulePlan)) { return(false); } DAL.SchedulePlan entity = db.SchedulePlan.Where(v => v.id == schedulePlan.id).FirstOrDefault(); if (entity == null && (entity = schedulePlan.saveInDB()) == null) { return(false); } // entity.boatToursManagerId = this.id; db.SaveChanges(); this.schedulePlans.Add(schedulePlan); return(true); }