public IActionResult AddPerson(Person person) { if (ModelState.IsValid) { _personRepo.AddPerson(person); return(RedirectToAction("list")); } return(View()); }
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)); }
public ActionResult <Person> Post(CreatePersonDto person) { var newPerson = _mapper.Map <Person>(person); return(_repository.AddPerson(newPerson)); }