© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
54 replies
BigggMoustache

❔ Viewing List from ViewBag

I'm not sure what to cast to make the
result
result
in
ViewBag.CardsReturned
ViewBag.CardsReturned
usable in the view. (Sorry if this was a load of unnecessary information)

Method creating the ViewBag:
        public async Task<IActionResult> Search(string searchString)
        {
            ICardService service = serviceProvider.GetCardService();
            var result = await service.Where(x => x.Name, searchString).AllAsync();
            ViewBag.CardsReturned = result;
            return View();
        }
        public async Task<IActionResult> Search(string searchString)
        {
            ICardService service = serviceProvider.GetCardService();
            var result = await service.Where(x => x.Name, searchString).AllAsync();
            ViewBag.CardsReturned = result;
            return View();
        }


What
ICardService
ICardService
and
AllSync
AllSync
are:
public interface ICardService : IMtgQueryable<ICardService, CardQueryParameter>
    {
        //
        // Summary:
        //     Gets all the MtgApiManager.Lib.Model.Card defined by the query parameters.
        //
        // Returns:
        //     A MtgApiManager.Lib.Core.IOperationResult`1 representing the result containing
        //     all the items.
        Task<IOperationResult<List<ICard>>> AllAsync();

        //
        // Summary:
        //     Find a specific card by its multi verse identifier.
        //
        // Parameters:
        //   multiverseId:
        //     The multi verse identifier to query for.
        //
        // Returns:
        //     A MtgApiManager.Lib.Core.IOperationResult`1 representing the result containing
        //     a MtgApiManager.Lib.Model.Card or an exception.
public interface ICardService : IMtgQueryable<ICardService, CardQueryParameter>
    {
        //
        // Summary:
        //     Gets all the MtgApiManager.Lib.Model.Card defined by the query parameters.
        //
        // Returns:
        //     A MtgApiManager.Lib.Core.IOperationResult`1 representing the result containing
        //     all the items.
        Task<IOperationResult<List<ICard>>> AllAsync();

        //
        // Summary:
        //     Find a specific card by its multi verse identifier.
        //
        // Parameters:
        //   multiverseId:
        //     The multi verse identifier to query for.
        //
        // Returns:
        //     A MtgApiManager.Lib.Core.IOperationResult`1 representing the result containing
        //     a MtgApiManager.Lib.Model.Card or an exception.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

Prevent scrollbar from jumping down when viewing a list?
C#CC# / help
4y ago
❔ Get list of indices from a List
C#CC# / help
3y ago
❔ ✅ remove from list (RevitAPI)
C#CC# / help
4y ago