public async Task <IActionResult> ManageUserFilter(int plan, int paymentstatus, int nullplan, int nullpaymentstatus)
        {
            Domain.Socioboard.Models.User _user = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.User>("User");
            if (_user == null)
            {
                return(RedirectToAction("Index", "Index"));
            }
            else
            {
                Domain.Socioboard.Models.UserDetails user = new Domain.Socioboard.Models.UserDetails();
                try
                {
                    HttpResponseMessage response = await WebApiReq.GetReq("/api/User/GetUserAdminFilter?plan=" + plan + "&paymentstatus=" + paymentstatus + "&nullplan=" + nullplan + "&nullpaymentstatus=" + nullpaymentstatus, "", "", _appSettings.ApiDomain);

                    if (response.IsSuccessStatusCode)
                    {
                        user = await response.Content.ReadAsAsync <Domain.Socioboard.Models.UserDetails>();
                    }

                    ViewBag.details   = user._user;
                    ViewBag.ApiDomain = _appSettings.ApiDomain;
                    ViewBag.Domain    = _appSettings.Domain;
                    return(View("ManageUser"));
                }
                catch (Exception ex)
                {
                    return(View("ManageUser"));
                }
            }
        }
Beispiel #2
0
        // GET: /<controller>/
        public async Task <IActionResult> ManageUser(string param)
        {
            Domain.Socioboard.Models.User _user = HttpContext.Session.GetObjectFromJson <Domain.Socioboard.Models.User>("User");
            if (_user == null)
            {
                return(RedirectToAction("Index", "Index"));
            }
            else
            {
                Domain.Socioboard.Models.UserDetails user = new Domain.Socioboard.Models.UserDetails();
                if (param == null)
                {
                    if (j == 0)
                    {
                        try
                        {
                            HttpResponseMessage response = await WebApiReq.GetReq("/api/User/GetUserAdmin?value=" + 0, "", "", _appSettings.ApiDomain);

                            if (response.IsSuccessStatusCode)
                            {
                                user = await response.Content.ReadAsAsync <Domain.Socioboard.Models.UserDetails>();
                            }
                            //count = 100;
                            //j = j + 500;
                            // ViewBag.Count = user.Count();
                            ViewBag.TotalCount = user.count;
                            ViewBag.Count      = user._user.Count();
                            ViewBag.details    = user._user;
                            ViewBag.ApiDomain  = _appSettings.ApiDomain;
                            ViewBag.Domain     = _appSettings.Domain;
                            return(View("ManageUser"));
                        }
                        catch (Exception ex)
                        {
                            return(View("ManageUser"));
                        }
                    }
                    else
                    {
                        HttpResponseMessage response = await WebApiReq.GetReq("/api/User/GetUserAdmin?value=" + j, "", "", _appSettings.ApiDomain);

                        if (response.IsSuccessStatusCode)
                        {
                            user = await response.Content.ReadAsAsync <Domain.Socioboard.Models.UserDetails>();
                        }
                        // j = j + 500;
                        ViewBag.details    = user._user;
                        ViewBag.Count      = user._user.Count() + j;
                        ViewBag.TotalCount = user.count;
                        ViewBag.ApiDomain  = _appSettings.ApiDomain;
                        ViewBag.Domain     = _appSettings.Domain;
                        return(View("ManageUser"));
                    }
                }
                else if (param == "Next")
                {
                    j = j + 500;
                    return(RedirectToAction("ManageUser"));
                }
                else
                {
                    j = j - 500;
                    return(RedirectToAction("ManageUser"));
                }



                //HttpResponseMessage response = await WebApiReq.GetReq("/api/User/GetUserAdmin", "", "", _appSettings.ApiDomain);
                //if (response.IsSuccessStatusCode)
                //{
                //    user = await response.Content.ReadAsAsync<List<Domain.Socioboard.Models.User>>();

                //}
                //ViewBag.details = user;
                //ViewBag.ApiDomain = _appSettings.ApiDomain;
                //ViewBag.Domain = _appSettings.Domain;
                //return View("ManageUser");
            }


            //return Json(user);
        }