public void UpdateMember(Member member) { using (var context = new IWNContext()) { context.Members.Attach(member); context.Entry(member).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public void SavePayment(Payment payment) { if (payment.TransactionId == 0) { AddPayment(payment); } using (IWNContext context = new IWNContext()) { context.Payments.Attach(payment); context.Entry(payment).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public void DeleteMembers(int memberId) { using (var context = new IWNContext()) { var memberToDelete = context.Members.First(member => member.MemberId == memberId); if (memberToDelete == null) { return; } memberToDelete.State = State.Deleted; context.Entry(memberToDelete).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }