Пример #1
0
        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();
            //}
        }
Пример #2
0
        public ActionResult AddContacts()
        {
            var model = new AddContactsViewModel()
            {
                Contacts = GetContactList(false).Take(10)
            };

            return(View(model));
        }
Пример #3
0
        public ActionResult AddContacts(AddContactsViewModel model, IList <HttpPostedFileBase> uploadFiles)
        {
            var files = Utility.GetFilesToUpload(model.FileNames, uploadFiles).Result;

            return(RedirectToAction("AddContacts"));
        }