public async Task <SpeakerDetailsModel> CreateAsync(SpeakerCreateModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } var speaker = Mapper.Map <Speaker>(model); await Repository.CreateAsync(speaker); await Audit.AuditCreatedAsync($"Speaker {speaker.FirstName} {speaker.LastName} has been created"); return(Mapper.Map <SpeakerDetailsModel>(speaker)); }
public async Task <IActionResult> CreateSpeakerAsync([FromBody] SpeakerCreateModel model) { var created = await Service.CreateAsync(model); return(CreatedAtRoute("GetSpeakerById", new { id = created.Id }, created)); }