public async Task <CreatedUrlDto> CreateUrl(NewUrlDto newUrlDto) { Url url = mapper.Map <Url>(newUrlDto); urlRepository.Insert(url); await unitOfWork.SaveAsync(); return(mapper.Map <CreatedUrlDto>(url)); }
public async Task <ActionResult <CreatedUrlDto> > Post([FromBody] NewUrlDto newUrlDto) { if (newUrlDto == null) { return(BadRequest()); } return(Ok(await urlService.CreateUrl(newUrlDto))); }