Dofactory.com
Dofactory.com
 Back to list
Views:   2.7K
Replies:  0
Archived

Webapi for PatternInAction , change the viewmodel from ActionResult to IQueryable type

Hi all

I am studying the PatternInAction project and i would like how to convert the presentation layer from Mvc to Webapi

May i know how to change the ViewModel in Mvc project to IQueryable ? 

For example, the below function, it returns in ActionResult, but how do i may OrdersModel to be IQueryable? 

Look forward your favourite reply. Thanks a lot


Regards
Billy
[HttpGet]
        public ActionResult Orders(string sort = "memberId", string order = "desc")
        {
            ViewBag.Crumbs = new List<BreadCrumb>();
            ViewBag.Crumbs.Add(new BreadCrumb { Title = "home", Url = "/" });
            ViewBag.Crumbs.Add(new BreadCrumb { Title = "administration", Url = "/administration" });
            ViewBag.Crumbs.Add(new BreadCrumb { Title = "orders" });

            ViewBag.Menu = "orders";

            var model = new OrdersModel();
            var members = service.GetMembersWithOrderStatistics(sort + " " + order);
            var memberModels = Mapper.Map<List<Member>, List<MemberModel>>(members);
            model.Members = new SortedList<MemberModel>(memberModels, sort, order);

            return View(model);
        }

 
Ho Yung Tsoi, Dec 15, 2016
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.