public void AddPackage(Package package) { using (var ctx = new CareManagmentDb()) { ctx.Packages.Add(package); ctx.SaveChanges(); } }
public void AddRecipient(Recipient recipient) { using (var ctx = new CareManagmentDb()) { ctx.Recipients.Add(recipient); ctx.SaveChanges(); } }
public void AddAdmin(Admin admin) { using (var ctx = new CareManagmentDb()) { ctx.Admins.Add(admin); ctx.SaveChanges(); } }
public void AddVolunteer(Volunteer volunteer) { using (var ctx = new CareManagmentDb()) { ctx.Volunteers.Add(volunteer); ctx.SaveChanges(); } }
public void UpdateDistribution(Distribution distribution) { using (var context = new CareManagmentDb()) { var old = context.Distributions.Find(distribution.DistributionId); old.AdminId = distribution.AdminId; old.VolunteerId = distribution.VolunteerId; old.IsDelivered = distribution.IsDelivered; old.Packages = distribution.Packages; old.Date = distribution.Date; context.SaveChanges(); } }
public void AddDistribution(Distribution distribution) { using (var ctx = new CareManagmentDb()) { //distribution.Admin = null; //distribution.Volunteer = null; foreach (Package p in distribution.Packages) { p.Recipient = null; } ctx.Distributions.Add(distribution); ctx.SaveChanges(); } }