Example #1
0
        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());
        }
Example #2
0
        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);
        }
Example #3
0
        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();
        }