Example #1
0
        //GET:                       // int? page, was added for pagination
        public ActionResult Index(int?page)
        {
            if (TempData["message"] != null)
            {
                ViewBag.Success = (string)TempData["message"];
            }
            var results = _ratMgr.GetRatings();

            if (results.Succeeded == true)
            {
                List <Rating> mylist = new List <Rating>();

                foreach (var item in results.Unwrap())
                {
                    item.TotalScore =
                        item.Quality + item.Quantity + item.Taste + item.CustomerServices + item.TimeLiness;
                }                             // this was added for pagination
                return(View(results.Unwrap().ToPagedList(page ?? 1, 12)));
            }
            else
            {
                ModelState.AddModelError(string.Empty, "An error occure");
                // this was added for pagination
                return(View(results.Unwrap().ToPagedList(page ?? 1, 12)));
            }
        }