public ActionResult Index(int page = 1, int size = 10, string user = null, int?status = null, string barcode = null)
        {
            if (!_sampleService.IsValid(page, size, user, status, barcode))
            {
                TempData["ValidRequest"] = false;
                return(RedirectToAction("Index", "Sample"));
            }

            if (TempData["ValidRequest"] != null)
            {
                ViewBag.Success = false;
                ViewBag.Message = "Invalid Search. Default Search Applied";
            }

            SampleIndexModel model = new SampleIndexModel
            {
                Page    = page,
                Size    = size,
                User    = user,
                Status  = status,
                Barcode = barcode,
            };

            model.InsertRecords(_sampleService.GetSamples(page, size, user, status, barcode));
            ViewBag.StatusList = new SelectList(_statusService.GetStatusList(), "Key", "Value");
            var pageCount = (double)_sampleService.GetTotalCount(user, status, barcode) / size;

            ViewBag.PageCount = Convert.ToInt32(Math.Ceiling(pageCount));

            return(View("Index", model));
        }
 public ActionResult Index(SampleIndexModel model)
 {
     return(RedirectToAction("Index",
                             new
     {
         page = model.Page,
         size = model.Size,
         user = model.User,
         status = model.Status,
         barcode = model.Barcode
     }));
 }