public async Task <IHttpActionResult> Delete(string id) { var result = new TransferObj <bool>(); NHACUNGCAP instance = await _service.Repository.FindAsync(id); if (instance == null) { return(NotFound()); } try { _service.Delete(instance.ID); int del = await _service.UnitOfWork.SaveAsync(); if (del > 0) { result.Data = true; result.Status = true; result.Message = "Xóa thành công bản ghi"; } else { result.Data = false; result.Status = false; result.Message = "Thao tác không thành công"; } } catch (Exception e) { result.Data = false; result.Status = false; result.Message = e.Message; } return(Ok(result)); }
/// <summary> /// Deletes the specified value. /// </summary> /// <param name="value">The value.</param> public void Delete(int value) { var entity = chatLieuService.GetById(value); chatLieuService.Delete(entity); }