public ActionResult Create(int id, AddContactsViewModel obj) { PhonebookDb1Entities db = new PhonebookDb1Entities(); Contact c = new Contact(); c.ContactNumber = obj.ContactNo; c.Type = obj.Type; c.PersonId = id; db.Contacts.Add(c); db.SaveChanges(); return(RedirectToAction("Index", "PersonCreate")); //try //{ // // TODO: Add insert logic here // return RedirectToAction("Index"); //} //catch //{ // return View(); //} }
public ActionResult AddContacts() { var model = new AddContactsViewModel() { Contacts = GetContactList(false).Take(10) }; return(View(model)); }
public ActionResult AddContacts(AddContactsViewModel model, IList <HttpPostedFileBase> uploadFiles) { var files = Utility.GetFilesToUpload(model.FileNames, uploadFiles).Result; return(RedirectToAction("AddContacts")); }