public ActionResult Edit(int Id) { MemberDatabase.Repo.ContactRepository repo = new MemberDatabase.Repo.ContactRepository(); MemberDatabase.Contact contact1 = repo.FindById(Id); return(View(contact1)); }
public ActionResult Comment(MemberDatabase.Contact myContact, MemberContext mem) { MemberDatabase.Comment com = new Comment(); com.comment = "new comment"; com.ContactId = myContact.Id; com.postDate = DateTime.Now; com.postedBy = "mfreedm"; mem.DbSet <Comment>().Add(com); mem.SaveChanges(); MemberDatabase.Repo.ContactRepository repo = new MemberDatabase.Repo.ContactRepository(); MemberDatabase.Contact contact1 = repo.FindById(myContact.Id); return(View("Edit", contact1)); }