public async Task <BaseResult> Delete(int wardId) { var rs = new BaseResult() { Result = Result.Success }; if (wardId > 0) { var ward = _wardRepository.Query().FirstOrDefault(c => c.Id == wardId); if (ward != null) { ward.IsDeleted = true; var wareHouses = _wareHouseRepository.Query() .Include(w => w.Ward) .Where(w => w.ParentId == wardId) .ToList(); foreach (WareHouse w in wareHouses) { await _wareHouseService.Delete(w.Id); } _wardRepository.Update(ward); try { _wardRepository.SaveChange(); } catch (Exception ex) { rs.Result = Result.SystemError; rs.Message = ex.ToString(); } } else { rs.Message = "Không tìm thấy xã / phường yêu cầu!"; rs.Result = Result.Failed; } } else { rs.Message = "Mã xã / phường không hợp lệ!"; rs.Result = Result.Failed; } return(rs); }
private void btnDelete_Click(object sender, EventArgs e) { if (Convert.ToInt32(lblID.Text) <= 0) { return; } if (MessageBox.Show(@"Confirm Delete WareHouse : " + lblName.Text, @"Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } if (!_wareHouseService.Delete(Convert.ToInt32(lblID.Text))) { return; } MessageBox.Show(@"Data Deleted Successfully", @"Delete", MessageBoxButtons.OK, MessageBoxIcon.Information); grdData.CurrentRow.Delete(); }
public bool Delete(Guid WareHouseId) { return(WareHouseService.Delete(EmployeeEntity, WareHouseId)); }
public async Task <IActionResult> Delete(int id) { var result = await _wareHouseService.Delete(id); return(Ok(result)); }
public IHttpActionResult Delete(List <string> ids) { return(Ok(_service.Delete(ids))); }