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"); } }
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; } }