public async Task AddOrRemoveListingFromFavoritesAsync(long listingId, bool isFavorite) { User user = await userManager.FindByEmailAsync(User.Identity.Name); var command = new AddOrRemoveListingFromFavoritesCommand { UserId = user.Id, ListingId = listingId, IsFavorite = isFavorite }; await pipelineService.HandleCommandAsync(command); }
/// <summary> /// Add or remove listing from favorites command handler async. /// </summary> /// <param name="listingCommand">Add or remove listing from favorites command.</param> public async Task HandleAddOrRemoveListingFromFavoritesCommandAsync(AddOrRemoveListingFromFavoritesCommand listingCommand) { await listingRepository.AddOrRemoveListingFromFavoritesAsync(listingCommand.UserId, listingCommand.ListingId, listingCommand.IsFavorite); }