/* ************ Partners *********** */ //public int SumPartnersFromOwner(int ownerId) //{ // return GetPartner().Count(x => x.OwnerId == ownerId); //} public void AddPartner(PartnerDbModel partner) { using (registry = new RegistryModel()) { registry.partners.Add(partner); registry.SaveChanges(); } }
public void UpdatePartner(PartnerDbModel chosenPartner) { using (registry = new RegistryModel()) { var updatePartner = registry.partners.FirstOrDefault(x => x.ID == chosenPartner.ID); updatePartner.Name = chosenPartner.Name; updatePartner.CountyId = chosenPartner.CountyId; updatePartner.OwnerId = chosenPartner.OwnerId; updatePartner.TypeId = chosenPartner.TypeId; updatePartner.ZipCode = chosenPartner.ZipCode; updatePartner.City = chosenPartner.City; updatePartner.Address = chosenPartner.Address; registry.SaveChanges(); } }