Boy_Scouts_Scheduler.Controllers.GroupController.GridData C# (CSharp) 메소드

GridData() 공개 메소드

public GridData ( int start, int itemsPerPage = 20, string orderBy = "ID", bool desc = false ) : System.Web.Mvc.ActionResult
start int
itemsPerPage int
orderBy string
desc bool
리턴 System.Web.Mvc.ActionResult
        public ActionResult GridData(int start = 0, int itemsPerPage = 20, string orderBy = "ID", bool desc = false)
        {
            Response.AppendHeader("X-Total-Row-Count", db.Groups.Count(g => g.Event.ID == eventID).ToString());
            ObjectQuery<Group> groups = (db as IObjectContextAdapter).ObjectContext.CreateObjectSet<Group>();
            groups = groups.OrderBy("it." + orderBy + (desc ? " desc" : ""));

            return PartialView(groups.Where(g => g.Event.ID == eventID).Skip(start).Take(itemsPerPage)
                                                                                   .Include(t => t.Type)
                                                                                   .Include(t => t.Preference1)
                                                                                   .Include(t => t.Preference2)
                                                                                   .Include(t => t.Preference3)
                                                                                   .Include(t => t.Preference4)
                                                                                   .Include(t => t.Preference5));
        }