public virtual async Task <bool> DeleteAsync(long id) { var result = false; try { var entity = ArtifactRepo.GetAsync(id); result = await ArtifactRepo.DeleteAsync(id); } catch (Exception ex) { Error(ex); } return(result); }
public virtual async Task <TUpdateDto> UpdateAsync(long id, [FromBody] TUpdateDto dto) { if (ModelState.IsValid) { TEntity entity = null; try { entity = await ArtifactRepo.GetAsync(id); entity = Mapper.Map(dto, entity); entity = await ArtifactRepo.UpdateAsync(entity); } catch (Exception ex) { Error(ex); } return(Mapper.Map <TUpdateDto>(entity)); } throw new HttpResponseException(HttpStatusCode.BadRequest, JsonConvert.SerializeObject(ModelState)); }