コード例 #1
0
ファイル: WardService.cs プロジェクト: Uaena1811/Old-Project
        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);
        }
コード例 #2
0
        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();
        }
コード例 #3
0
ファイル: WareHouseController.cs プロジェクト: linhlpv/EShop-
 public bool Delete(Guid WareHouseId)
 {
     return(WareHouseService.Delete(EmployeeEntity, WareHouseId));
 }
コード例 #4
0
        public async Task <IActionResult> Delete(int id)
        {
            var result = await _wareHouseService.Delete(id);

            return(Ok(result));
        }
コード例 #5
0
 public IHttpActionResult Delete(List <string> ids)
 {
     return(Ok(_service.Delete(ids)));
 }