Example #1
0
        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();
        }
Example #3
0
 public bool Delete(Guid WareHouseId)
 {
     return(WareHouseService.Delete(EmployeeEntity, WareHouseId));
 }
Example #4
0
        public async Task <IActionResult> Delete(int id)
        {
            var result = await _wareHouseService.Delete(id);

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