public PriceCategory(string name, TripType tripType, PersonCategory personCategory, decimal price, Route route) { this.name = name ?? throw new ArgumentNullException(nameof(name)); this.tripType = tripType ?? throw new ArgumentNullException(nameof(tripType)); this.personCategory = personCategory ?? throw new ArgumentNullException(nameof(personCategory)); this.price = price; this.route = route ?? throw new ArgumentNullException(nameof(route)); }
public bool removePersonCategory(PersonCategory personCategory) { DAL.PersonCategory entity = db.PersonCategory.Where(v => v.id == personCategory.id).FirstOrDefault(); if (entity == null) { return(false); } //entity.boatToursManagerId = null; db.SaveChanges(); return(this.personCategories.Remove(personCategory)); }
public bool addPersonCategory(PersonCategory personCategory) { if (this.personCategories.Contains(personCategory)) { return(false); } DAL.PersonCategory entity = db.PersonCategory.Where(v => v.id == personCategory.id).FirstOrDefault(); if (entity == null && (entity = personCategory.saveInDB()) == null) { return(false); } // entity.boatToursManagerId = this.id; db.SaveChanges(); this.personCategories.Add(personCategory); return(true); }