public IActionResult AddPerson(Person person)
        {
            if (ModelState.IsValid)
            {
                _personRepo.AddPerson(person);
                return(RedirectToAction("list"));
            }

            return(View());
        }
Пример #2
0
        public ActionResult <string> Post([FromBody] Person person)
        {
            var result = _personRepo.AddPerson(person);

            if (result.Success)
            {
                return(Ok("Success"));
            }
            else
            {
                return(BadRequest(result.Reason));
            }
        }
 public string AddPerson(Person person)
 {
     return(_personRepo.AddPerson(person));
 }
Пример #4
0
        public ActionResult <Person> Post(CreatePersonDto person)
        {
            var newPerson = _mapper.Map <Person>(person);

            return(_repository.AddPerson(newPerson));
        }