public async Task UpdateAsync([FromBody] InstrumentEditModel model) { try { var instrument = Mapper.Map <Instrument>(model); await _instrumentService.UpdateAsync(instrument); } catch (EntityNotFoundException) { throw new ValidationApiException(HttpStatusCode.NotFound, "Instrument does not exist."); } }
public async Task AddAsync([FromBody] InstrumentEditModel model) { try { var instrument = Mapper.Map <Instrument>(model); await _instrumentService.AddAsync(instrument); } catch (InvalidOperationException exception) { throw new ValidationApiException(HttpStatusCode.BadRequest, exception.Message); } }