public async Task <IViewComponentResult> InvokeAsync()
        {
            var result = await _licenseInterface.GetLicenses(Request.Cookies["AssetReference"].ToString());

            //Map the objects results to corresponding DTO's
            IEnumerable <LicenseDTO> licenseDTOs = _mapper.Map <IEnumerable <LicenseDTO> >(result);

            ViewBag.TotalLicensesCount = licenseDTOs.ToList().Count();

            return(View(licenseDTOs));
        }
        public async Task <IActionResult> Index(string paramStatus, string token, string sortOrder, string currentFilter, string searchString, int?pageNumber)
        {
            try
            {
                ViewData["CurrentSort"]  = sortOrder;
                ViewData["NameSortParm"] = String.IsNullOrEmpty(sortOrder) ? "ProductName" : "";
                ViewData["DateSortParm"] = sortOrder == "ProductVersion" ? "LicenseKey" : "ProductVersion";

                if (searchString != null)
                {
                    pageNumber = 1;
                }
                else
                {
                    searchString = currentFilter;
                }

                if (Request.Cookies["AssetReference"] == null)
                {
                    return(RedirectToAction("Index", "Error"));
                }

                var listLicense = new List <LicenseDTO>();

                listLicense = await _licenseInterface.GetLicenses(Request.Cookies["AssetReference"].ToString());

                var model = listLicense.AsQueryable();

                if (!String.IsNullOrEmpty(searchString))
                {
                    model = listLicense.AsQueryable().Where(x => x.ProductName.Contains(searchString) || x.ProductVersion.Equals(searchString) || x.LicenseKey.Equals(searchString));
                }

                switch (sortOrder)
                {
                case "ProductName":
                    model = model.OrderByDescending(s => s.ProductName);
                    break;

                case "ProductVersion":
                    model = model.OrderByDescending(s => s.ProductVersion);
                    break;

                case "LicenseKey":
                    model = model.OrderByDescending(s => s.LicenseKey);
                    break;

                default:
                    model = model.OrderBy(s => s.ProductName);
                    break;
                }

                int pageSize = 10;
                return(View(await PaginatedList <LicenseDTO> .CreateAsync(model.AsNoTracking(), pageNumber ?? 1, pageSize)));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Error encountered in LicenseController||Index ErrorMessage: {ex.Message}");
                return(RedirectToAction("Index", "Error"));
            }
        }