示例#1
0
        public async Task <bool> DeleteAsync(Watchlist item)
        {
            bool result = _repository.Remove(item);

            if (result)
            {
                await _repository.UnitOfWork.SaveChangesAsync();

                return(result);
            }
            else
            {
                throw new NotFoundException(ErrorCode.MarketNotFount, "Watchlist not found");
            }
        }
示例#2
0
        public IActionResult Remove(int id)
        {
            var watchlist = _watchlistRepository.GetWatchlist(id);

            _watchlistRepository.Remove(watchlist);

            _clientNotification
            .AddSweetNotification("Success", "Pet has been removed from watchlist", NotificationType.success);

            return(RedirectToAction(nameof(Index)));
        }
        public IActionResult Remove(int Id)
        {
            if (Id == 0)
            {
                return(Content("Invalid request"));
            }

            try{
                _repository.Remove(_repository.GetWatchlist(Id));
                return(RedirectToAction(nameof(Index)));
            } catch (Exception ex) {
                throw ex;
            }
        }