public void DoFirstTimeInit(PantryDBContext db) { db.Households.Add(this); db.SaveChanges(); var settings = new AppSettings(); settings.DoFirstTimeInit(db, this.id); }
public void Delete(PantryDBContext db) { foreach (GoodBag pantry in this.GetPantry(db)) { pantry.Delete(db); } db.AppSettingses.Remove(this); db.SaveChanges(); }
public void DoFirstTimeInit(PantryDBContext db, int household_id) { var pantry = new GoodBag(); pantry.DoFirstTimeInit(db); this.ShoppingDay = 0; this.PantryId = pantry.id; this.HouseholdId = household_id; db.AppSettingses.Add(this); db.SaveChanges(); }
public void Delete(PantryDBContext db) { foreach (var good_type in this.GetGoodTypes(db)) { good_type.Delete(db); } foreach (var family_member in this.GetFamilyMembers(db)) { family_member.Delete(db); } foreach (var app_settings in this.GetAllAppSettings(db)) { app_settings.Delete(db); } db.Households.Remove(this); db.SaveChanges(); }
public void Delete(PantryDBContext db) { db.Remove(this); db.SaveChanges(); }
public void DoFirstTimeInit(PantryDBContext db) { db.GoodBags.Add(this); db.SaveChanges(); }
public void Delete(PantryDBContext db) { //Need to also delete all instances of this type later db.GoodTypes.Remove(this); db.SaveChanges(); }
public IEnumerable <GoodBag> GetPantry(PantryDBContext db) { return(db.GoodBags.Where(gb => gb.id == this.PantryId)); }
public void DeleteFamilyMemberById(PantryDBContext db, int family_member_id) { db.FamilyMembers .RemoveRange(db.FamilyMembers.Where(m => m.id == family_member_id && m.HouseholdId == this.id)); db.SaveChanges(); }
public IEnumerable <AppSettings> GetAllAppSettings(PantryDBContext db) { return(db.AppSettingses.Where(a => a.HouseholdId == this.id)); }
public IEnumerable <GoodType> GetGoodTypes(PantryDBContext db) { return(db.GoodTypes.Where(gt => gt.HouseholdId == this.id)); }
public void AddGoodType(PantryDBContext db, GoodType new_good_type) { new_good_type.HouseholdId = this.id; db.GoodTypes.Add(new_good_type); db.SaveChanges(); }
public void AddFamilyMember(PantryDBContext db, FamilyMember new_family_member) { new_family_member.HouseholdId = this.id; db.FamilyMembers.Add(new_family_member); db.SaveChanges(); }
public IEnumerable <FamilyMember> GetFamilyMembers(PantryDBContext db) { return(db.FamilyMembers.Where(fm => fm.HouseholdId == this.id)); }