public IActionResult Create(PersonCreateCommandModel model) { if (!ModelState.IsValid) { return(View(model)); } var person = _service.Create(model); if (person != null) { return(RedirectToAction("Index", "Home")); } return(View()); }
public PersonCreateCommandModel Create(PersonCreateCommandModel cmd) { var model = new Assgn10Person { FirstName = cmd.FirstName, LastName = cmd.LastName, BirthDate = cmd.BirthDate, City = cmd.City, State = cmd.State, IsDeleted = false, }; _assgn10Context.People.Add(model); _assgn10Context.SaveChanges(); return(cmd); }
public void LogRequest(PersonCreateCommandModel cmd) { DateTime currentDate = DateTime.Now; var model = new Assgn10Person { FirstName = "**Logging**", LastName = "**Access API**", BirthDate = currentDate, City = "*********", State = "********", IsDeleted = false, }; _assgn10Context.People.Add(model); _assgn10Context.SaveChanges(); }