Example #1
0
        // GET: All Property
        public ActionResult GetAllProperty(string Search_Data, int?Page_No, string Filter_Value)
        {
            var allProperty = _getPropertyDetailsWithUser.GetAllProperty();

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;

            if (!string.IsNullOrEmpty(Search_Data))
            {
                allProperty = allProperty.Where(x => x.University.ToLower().Contains(Search_Data.ToLower()));
            }

            int Size_Of_Page = 2;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(allProperty.ToPagedList(No_Of_Page, Size_Of_Page)));
        }
        public ActionResult GetAllUsers(string Search_Data, int?Page_No, string Filter_Value)
        {
            var user   = _getUser.GetAll();
            var userId = User.Identity.GetSecurityUserId();

            ViewBag.UserId = userId;

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;

            if (!string.IsNullOrEmpty(Search_Data))
            {
                user = user.Where(x => x.University.ToLower().Contains(Search_Data.ToLower()));
            }

            int Size_Of_Page = 2;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(user.ToList().ToPagedList(No_Of_Page, Size_Of_Page)));
        }
Example #3
0
        // GET: Movie
        public ActionResult Index(string Search_Data, string Filter_Value, int?Page_No)
        {
            IEnumerable <MovieModel> movies = null;

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;
            int Size_Of_Page = 4;
            int No_Of_Page   = (Page_No ?? 1);

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("https://localhost:44329/api/");
                var responseTask = client.GetAsync("movies");

                var result = responseTask.Result;

                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <IList <MovieModel> >();
                    readTask.Wait();

                    ViewBag.FilterValue = Search_Data;
                    movies = readTask.Result;
                    if (!String.IsNullOrEmpty(Search_Data))
                    {
                        movies = movies.Where(s => s.title.ToLower() == Search_Data.ToLower()).OrderByDescending(s => s.year);
                    }
                    else
                    {
                        movies = movies.OrderByDescending(s => s.year);
                    }
                }
                else
                {
                    movies = Enumerable.Empty <MovieModel>();
                    ModelState.AddModelError(string.Empty, "Server error. Please contact administrator.");
                }
            }
            return(View(movies.ToPagedList(No_Of_Page, Size_Of_Page)));
        }