Example #1
0
 public JsonResult Autocomplete(Guid gid, string query, int offset = 0, int count = 10)
 {
     var apps = new Apps();
     AppList appList;
     if (DefaultApp != null && DefaultApp.Name.ToLower().Contains(query.ToLower().Trim()))
     {
         appList = apps.SearchGroupApps(gid, query, offset, (offset > 0) ? count : count - 1);
         var appendedApps = appList.Apps.ToList();
         appendedApps.Insert(0, new AppListItem() { Key = DefaultApp.Key, Name = DefaultApp.Name });
         appList.Apps = appendedApps;
         appList.TotalCount += 1;
         if (offset == 0) appList.PageSize += 1;
     }
     else
     {
         appList = apps.SearchGroupApps(gid, query, offset, count);
     }
     return Json(appList);
 }
Example #2
0
        //
        // GET: /App/
        public ActionResult Index(Guid gid, string q = null, int o = 0, int c = 50)
        {
            if (o < 0) o = 0;
            if (c < 1) o = 1;
            if (c > 100) o = 100;

            var apps = new Apps();
            var groups = new Groups();

            var appList = apps.SearchGroupApps(gid, q, o, c);
            var group = groups.GetGroup(gid);

            var model = new AppIndex()
            {
                AppList = appList,
                Group = group,
            };

            return View(model);
        }