public async Task <IActionResult> PostLinks(LinksDto linksDto) { var links = mapper.Map <Links>(linksDto); uow.LinksRepository.addLinks(links); await uow.SaveAsync(); return(StatusCode(201)); }
public async Task <IActionResult> PutLinks(int id, LinksDto linksDto) { if (id != linksDto.Id) { return(BadRequest("Update not allowed")); } var linksFromDb = await uow.LinksRepository.findLinksAsync(id); if (linksFromDb == null) { return(BadRequest("Update not allowed")); } mapper.Map(linksDto, linksFromDb); await uow.SaveAsync(); return(StatusCode(200)); }