public ActionResult AddContact(Contact contact) { var database = new FakeContactDatabase(); database.Add(contact); return(RedirectToAction("Index")); }
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); }
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")); }
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")); }