Пример #1
0
        public async Task <IGenericResult> Delete(Guid id)
        {
            var seller = await _sellerRepository.FindById(id);

            if (seller == null)
            {
                return(new GenericResult(false, "Vendedor não existe."));
            }

            await _sellerRepository.Delete(seller);

            return(new GenericResult(true, "Vendedor excluido com sucesso.", null));
        }
Пример #2
0
        public async Task <IActionResult> DeleteConfirmed(string id)
        {
            var seller = await _sellerRepostory.GetById(id);

            try
            {
                _sellerRepostory.Delete(seller);
                await _unitOfWork.SaveChanges();

                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception e)
            {
                return(View(seller));
            }
        }
Пример #3
0
        public IActionResult Delete(int id)
        {
            Seller _sellerDb = _sellerRepository.GetSingle(id);

            if (_sellerDb == null)
            {
                return(new NotFoundResult());
            }
            else
            {
                _sellerRepository.Delete(_sellerDb);

                _sellerRepository.Commit();

                return(new NoContentResult());
            }
        }
Пример #4
0
        public async Task <IActionResult> Delete(int id)
        {
            var location = GetControllerActionNames();

            try
            {
                _logger.LogInfo($"{location}: Delete Attempted on record with id: {id}");
                if (id < 1)
                {
                    _logger.LogWarn($"{location}: Delete failed with bad data - id:{id}");
                    return(BadRequest());
                }
                var isExists = await _sellerRepository.isExists(id);

                if (!isExists)
                {
                    _logger.LogWarn($"{location}: Failed to retrieve record with id:  {id}");
                    return(NotFound());
                }

                var seller = await _sellerRepository.FindById(id);

                var isSuccess = await _sellerRepository.Delete(seller);

                if (!isSuccess)
                {
                    return(internalError($"{location}: Delete Failed for record  with id:  {id}"));
                }
                _logger.LogInfo($"{location}: Record with id:  {id} successfully delete");
                return(NoContent());
            }
            catch (Exception e)
            {
                return(internalError($"{location}: {e.Message} - {e.InnerException}"));
            }
        }
Пример #5
0
 public bool Delete(Seller t)
 {
     return(sellerRepository.Delete(t));
 }
Пример #6
0
 public ActionResult SellerDelete(string id)
 {
     _sellerRepository.Delete(id);
     _sellerRepository.SaveChanges();
     return(RedirectToAction("UserList"));
 }
        public async Task <ActionResult <bool> > Delete(string id)
        {
            var result = await _sellerRepository.Delete(id);

            return(Ok(result));
        }