public async Task <IActionResult> Insert([FromBody] AssetInputDTO request) { try { Asset asset = new Asset() { Tags = request.Tags, Extra = request.Extra }; _assetService.Insert(asset); return(Ok(asset)); } catch (Exception ex) { return(StatusCode((int)HttpStatusCode.InternalServerError)); } }
public async Task <IActionResult> Update([FromBody] AssetInputDTO request, [FromRoute] string id) { try { Asset asset = _assetService.GetById(id); if (asset == null) { return(NotFound()); } asset.Tags = request.Tags; asset.Extra = request.Extra; _assetService.Update(asset); return(Ok(asset)); } catch { return(StatusCode((int)HttpStatusCode.InternalServerError)); } }