public IActionResult Post(Consultant consultant) { var newConsultant = consultantService.Create(consultant); if (newConsultant.Id == Guid.Empty) { return(StatusCode(500)); } return(CreatedAtAction("Get", newConsultant)); }
public IActionResult Post([FromBody] CreateConsultantViewModel vm) { return(ApiAction(() => { var contract = _mapper.Map <CreateConsultantContract>(vm); var returnContract = _consultantService.Create(contract); return Created("Get", _mapper.Map <CreatedConsultantViewModel>(returnContract)); })); }