public async Task DeleteSupplier(int productId, CancellationToken cancellationToken = default)
        {
            cancellationToken.ThrowIfCancellationRequested();
            Supplier supplier = new() { SupplierId = productId, Deleted = true };

            await _productRepository.Delete(supplier, cancellationToken);
        }
Beispiel #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Supplier supplier = _supplierContext.Get(s => s.ID == id);

            _supplierContext.Delete(supplier);
            return(RedirectToAction("Index"));
        }
        // GET: SupplierController/Delete/5
        public ActionResult Delete(int id)
        {
            var supplier = _repo.FindById(id);

            if (supplier == null)
            {
                return(NotFound());
            }
            var IsSuccess = _repo.Delete(supplier);

            if (!IsSuccess)
            {
                return(BadRequest());
            }
            return(RedirectToAction(nameof(Index)));
        }
 public JsonResult DeleteSupplier(int id)
 {
     try
     {
         var data = _iSupplierRepository.Get(id);
         _iSupplierRepository.Delete(data);
         _iSupplierRepository.Save(RequestContext);
         return(Json(new
         {
             isDeleted = true,
             html = Helper
                    .RenderRazorViewToString(this, "_ViewListSuppliers", _iSupplierRepository.All.ToList())
         }));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         return(Json(new
         {
             isDeleted = false,
             html = Helper
                    .RenderRazorViewToString(this, "_ViewListSuppliers", _iSupplierRepository.All.ToList())
         }));
     }
 }
Beispiel #5
0
        public bool Delete(int?Id)
        {
            if (Id == null)
            {
                Console.WriteLine("Insert Id");
                Console.Read();
            }
            else if (Id == ' ')
            {
                Console.WriteLine("Dont Insert Blank Caracter");
                Console.Read();
            }
            else
            {
                status = _supplierRepository.Delete(Id);
                Console.WriteLine("Success");
            }
            return(status);

            //if (Id == null)
            //{
            //    _supplierRepository.Delete(Id);
            //    status = true;
            //}
            //return status;
        }
Beispiel #6
0
        public async Task <int> Handle(DeleteSupplierCommand request, CancellationToken cancellationToken)
        {
            var model = new Domain.OxiServi.AggregatesModel.SuppliersAggregate.Supplier();

            model.Delete(request.SupplierId);
            return(await _supplierRepository.Delete(model));
        }
Beispiel #7
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            var movie = await _context.GetAsync(m => m.Id == id);

            _context.Delete(movie);
            await _context.SaveAsync();

            return(RedirectToAction(nameof(Index)));
        }
        public bool Delete(int?Id)
        {
            var idDel = Get(Id);

            if (idDel != null)
            {
                status = _supplierRepository.Delete(Id);
            }
            return(status);
        }
        public void Delete(int id)
        {
            Supplier cusToDelete = _supRepository.Get(c => c.ID == id);

            if (cusToDelete == null)
            {
                throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Supplier to delete does not exits."));
            }
            _supRepository.Delete(cusToDelete);
        }
Beispiel #10
0
        public void DeleteForm(string keyValue)
        {
            if (string.IsNullOrWhiteSpace(keyValue))
            {
                throw new Exception("供应商的删除ID不能为空");
            }
            var entity = repository.FindEntity(keyValue);

            repository.Delete(entity);
        }
        public async Task Delete(Guid id)
        {
            if (_repository.Get(id).Result.Products.Any())
            {
                Notify("Não é possível excluir um fornecedor com produtos cadastrados");
                return;
            }

            await _repository.Delete(id);
        }
        public async Task Delete(Guid id)
        {
            await ValidateEntityExistence(id);

            if (_notificationService.HasNotifications())
            {
                return;
            }
            await _supplierRepository.Delete(id);
        }
Beispiel #13
0
 public void DeleteForm(string keyValue)
 {
     if (service.IQueryable().Count(t => t.SupplierId.Equals(keyValue)) > 0)
     {
         throw new Exception("删除失败!操作的对象包含了下级数据。");
     }
     else
     {
         service.Delete(t => t.F_Id == keyValue);
     }
 }
Beispiel #14
0
 public bool Delete(int id)
 {
     if (string.IsNullOrWhiteSpace(id.ToString()))
     {
         return(_status);
     }
     else
     {
         return(iSupplierRepository.Delete(id));
     }
 }
Beispiel #15
0
 public int Delete(int id)
 {
     if (string.IsNullOrWhiteSpace(id.ToString()))
     {
         return(0);
     }
     else
     {
         return(_supplierRepository.Delete(id));
     }
 }
        public ActionResult DeleteSupplier(int supplierId)
        {
            var supplier = supplierRepository.Find(supplierId);

            if (supplier != null)
            {
                supplierRepository.Delete(supplier);
                return(RedirectToAction("SupplierList"));
            }
            return(RedirectToAction("SupplierList"));
        }
Beispiel #17
0
        public bool Delete(int?Id)
        {
            var getId = Get(Id);

            if (getId != null)
            {
                _supplierRepository.Delete(Id);
                status = true;
            }
            return(status);
        }
 public int Delete(int Id)
 {
     if (string.IsNullOrWhiteSpace(Id.ToString()))
     {
         return(0);
     }
     else
     {
         return(_supplierRepository.Delete(Id));
     }
     //throw new NotImplementedException();
 }
Beispiel #19
0
        public bool Delete(int?id)
        {
            var getid       = Get(id);
            var getsupplier = false;

            if (getid != null)
            {
                getsupplier = _supplierRepository.Delete(id);
                status      = true;
            }
            return(status);
        }
        public void DeleteSupplierFromRepository()
        {
            Supplier toDelete = MockSupRepository.Get(u => u.ID == 3);

            MockSupRepository.Delete(toDelete);
            IList <Supplier> list    = MockSupRepository.GetAll();
            Supplier         deleted = MockSupRepository.Get(u => u.ID == 3);

            Assert.IsNull(deleted);
            Assert.IsNotNull(list);
            Assert.AreEqual(2, list.Count);
        }
        public async Task <IActionResult> Delete(Guid id)
        {
            var result = await supplieRepository.FindByKey(id);

            if (result == null)
            {
                return(NotFound());
            }

            await supplieRepository.Delete(result);

            return(Ok());
        }
        public async Task Delete(int id)
        {
            try
            {
                var supplier = await SupplierGet(id);

                await _repository.Delete(supplier);
            }
            catch (Exception ex)
            {
                throw new ServicesException(EXEPTION_COMUNICATION_ERROR, ex);
            }
        }
 public Task Delete(int id)
 {
     try
     {
         _repository.Delete(id);
         return(Task.CompletedTask);
     }
     catch (Exception ex)
     {
         _logger.LogError(ex, ex.Message);
         throw ex;
     }
 }
        public async Task <ServiceResult <bool> > Delete(int id)
        {
            if (id <= 0)
            {
                throw new ArgumentException("Argument should be greater than 0", nameof(id));
            }

            var model = await _repository.GetSingleAsync(id);

            _repository.Delete(model);
            var changes = await _repository.SaveChangesAsync();

            return(ServiceResultFactory.Success(changes > 0));
        }
        public void Delete(Guid id)
        {
            if (id == Guid.Empty)
            {
                throw new ValidationException("O fornecedor precisa ser informado.");
            }
            var supplier = _supplierRepository.GetById(id);

            if (supplier == null)
            {
                throw new ValidationException("Fornecedor não encontrado");
            }
            _supplierRepository.Delete(supplier);
        }
Beispiel #26
0
        public string Delete(int id)
        {
            string message = "";

            try
            {
                int result = _supplierRepository.Delete(id);
                message = _messageClass.ShowDeleteMessage(result);
            }
            catch (SqlException ex)
            {
                message = _messageClass.ShowErrorMessage(string.Format("{0} ~ {1}", ex.Number.ToString(), ex.Message));
            }
            return(message);
        }
Beispiel #27
0
        public bool Delete(object id)
        {
            var entity = _supplierRepository.GetById(id);

            if (entity == null)
            {
                return(false);
            }
            if (_productRepository.GetAll().Any(p => p.SupplierId == entity.SupplierId) ||
                _purchaseBillBusiness.GetAll().Any(p => p.SupplierId == entity.SupplierId))
            {
                return(false);
            }
            return(_supplierRepository.Delete(entity));
        }
Beispiel #28
0
        public bool DeleteSupplier(int supplierId)
        {
            var supplier = _supplierRepository.Get(s => s.Id == supplierId);

            _supplierRepository.Delete(supplier);
            try
            {
                SaveSupplier();
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
        public async Task <bool> Handle(SupplierDeleteRequest request, CancellationToken cancellationToken)
        {
            try
            {
                await supplierRepository.Delete(request.Id);

                return(await Task.Run(() => true));
            }
            catch (ValidationExistException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new SaveException(ex.Message);
            }
        }
        public SupplierDto DeleteSupplier(int id)
        {
            var existed = this.SupplierExists(id);

            if (!existed)
            {
                return(null);
            }
            var supplier = _repo.GetById(id);
            int res      = _repo.Delete(supplier);

            if (res <= 0)
            {
                return(null);
            }
            return(_mapper.Map <SupplierDto>(supplier));
        }