public ActionResult Delete(PersonCL.Person person) { Person.Models.PersonViewModel per = new Models.PersonViewModel() { Id = person.ID, Age = person.Age, FirstName = person.FirstName, LastName = person.LastName }; return(View(per)); }
public IHttpActionResult PostNewPerson(Models.PersonViewModel pPerson) { if (ModelState.IsValid) { using (StreamWriter sw = File.AppendText(HostingEnvironment.MapPath("~/InputFiles/Pipe.txt"))) { sw.WriteLine(pPerson.LastName + "|" + pPerson.FirstName + "|" + pPerson.PersonGender + "|" + pPerson.FavoriteColor + "|" + pPerson.DateOfBirth.ToShortDateString()); } return(Ok()); } else { return(BadRequest()); } }
public ActionResult AddPerson(Models.PersonViewModel pPerson) { using (var client = new HttpClient()) { client.BaseAddress = new Uri("http://localhost:62143/records"); var postTask = client.PostAsJsonAsync <Models.PersonViewModel>("records", pPerson); postTask.Wait(); var result = postTask.Result; if (result.IsSuccessStatusCode) { return(RedirectToAction("Index")); } } ModelState.AddModelError(string.Empty, "Server Error. Please contact administrator."); return(View(pPerson)); }
public ActionResult Contact() { ViewBag.Message = "Your contact page."; Models.PersonViewModel p = new Models.PersonViewModel(); return(View(p)); }
public ActionResult Index() { var model = new Models.PersonViewModel() { Name = "Anonymous", Deposit = 50 }; return View(model); }
public ActionResult Delete(PersonCL.Person person) { Person.Models.PersonViewModel per = new Models.PersonViewModel() { Id = person.ID, Age = person.Age, FirstName = person.FirstName, LastName = person.LastName }; return View(per); }