public PersonDto CreatePerson(PersonToCreateDto person) { var entity = Mapper.Map <Data.Entities.Person>(person); _db.PersonRepository.Add(entity); _db.Save(); return(Mapper.Map <PersonDto>(entity)); }
public IActionResult CreatePerson([FromBody] PersonToCreateDto person) { if (person == null) { return(BadRequest(new { Message = "Model could not be parsed." })); } var createdPerson = _personManagement.CreatePerson(person); return(CreatedAtAction(nameof(GetPerson), new { id = createdPerson.Id }, createdPerson)); }