Esempio n. 1
0
        public ActionResult EditContact()
        {
            var contact = new Contact();

            contact.Name        = Request.Form["Name"];
            contact.PhoneNumber = Request.Form["PhoneNumber"];
            contact.ContactId   = int.Parse(Request.Form["ContactId"]);

            var database = new FakeContactDatabase();

            database.Edit(contact);

            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public ActionResult EditContact(Contact c)
        {
            //// create a contact
            //var c = new Contact();

            //// get the data from the input fields
            //// ContactId, Name, and PhoneNuumber

            //c.Name = Request.Form["Name"];
            //c.PhoneNumber = Request.Form["PhoneNumber"];
            //c.ContactId = int.Parse(Request.Form["ContactId"]);

            // create our fake dataase
            var database = new FakeContactDatabase();

            //send the edited contact redord to the database
            database.Edit(c);

            // tell the browser to navigate to Home/Index
            return(RedirectToAction("Index"));
        }