Пример #1
0
        public ActionResult AddContact(Contact contact)
        {
            var database = new FakeContactDatabase();

            database.Add(contact);

            return(RedirectToAction("Index"));
        }
Пример #2
0
        public HttpResponseMessage Post(Contact newContact)
        {
            var repo = new FakeContactDatabase();

            repo.Add(newContact);
            var    response = Request.CreateResponse(HttpStatusCode.Created);
            string uri      = Url.Link("DefaultApi", new { id = newContact.ContactId });

            response.Headers.Location = new Uri(uri);

            return(response);
        }
Пример #3
0
        public ActionResult AddContact(Contact c)
        {
            //// create a contact
            //var c = new Contact();

            //// get the data from the input fields Name and PhoneNumber
            //c.Name = Request.Form["Name"];
            //c.PhoneNumber = Request.Form["PhoneNumber"];

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

            database.Add(c);

            // add the contact record to the database
            return(RedirectToAction("Index"));
        }
Пример #4
0
        public ActionResult AddContact()
        {
            //create a contact
            var c = new Contact();

            // get the data from the text boxes
            c.Name        = Request.Form["Name"];
            c.PhoneNumber = Request.Form["PhoneNumber"];

            //create Fake Db
            var database = new FakeContactDatabase();

            //add the info to db
            database.Add(c);

            //nav to home view
            return(RedirectToAction("Index"));
        }