public IActionResult Delete(int id) { try { var blogarticle = _repository.GetById(id).Result; if (blogarticle == null) { return(NotFound(ErrorCode.RecordNotFound.ToString())); } _repository.DeleteAsync(blogarticle); } catch (Exception e) { return(BadRequest(ErrorCode.CouldNotDeleteItem.ToString())); } return(NoContent()); }