public ActionResult Edit(int Id, MemberContext mem) { MemberDatabase.Member contact1 = mem.DbSet <Member>().Find(Id); return(View(contact1)); }
// GET: Payment public ActionResult Index(MemberContext mem) { string username = User.Identity.Name; MemberDatabase.Member myMemberObj = new MemberDatabase.Member(); // unitOfWork.Repository<MemberDatabase.Member>(); return(View(myMemberObj)); }
public ActionResult Add(MemberDatabase.Member myMember, MemberContext mem) { mem.Members.Add(myMember); mem.SaveChanges(); List <Member> memList = mem.DbSet <Member>().ToList(); return(View("Index", memList)); }
public ActionResult Update(MemberDatabase.Member myMember, MemberContext mem) { //var unitOfWork = new GenericRepository.UnitOfWork(mem); mem.DbSet <Member>().Add(myMember); //unitOfWork.Repository<MemberDatabase.Member>().Update(myMember); // mem.Entry(myContact).Property(m => m.Username).IsModified = true; // mem.Entry(myMember).Property(m => m.FirstName).IsModified = true; // mem.Entry(myMember).Property(m => m.LastName).IsModified = true; // mem.Entry(myMember).Property(m => m.Email).IsModified = true; mem.SaveChanges(); return(RedirectToAction("Index", "Home")); }
public ActionResult Update(MemberDatabase.Member myMember, MemberContext mem) { // unitOfWork.Repository<MemberDatabase.Member>().Update(myMember); //we dont want to expose this, we should handle this in the update method // mem.Entry(myContact).Property(m => m.Username).IsModified = true; // mem.Entry(myMember).Property(m => m.FirstName).IsModified = true; /// mem.Entry(myMember).Property(m => m.LastName).IsModified = true; // mem.Entry(myMember).Property(m => m.Email).IsModified = true; // unitOfWork.Save(); List <Member> memList = mem.DbSet <Member>().ToList(); return(View("Index", memList)); }