public IActionResult Index()
        {
            try
            {
                IndexMasterAssetsAssignmentViewModel objIndexMasterAssetsAssignmentViewModel = new IndexMasterAssetsAssignmentViewModel();
                //Generate List Of Employees
                IEnumerable <AssetsAssignEmployeeViewModel> objAssetsAssignEmployeeViewModelList = null;
                string        endpoint        = apiBaseUrl + "MasterEmployees";
                Task <string> HttpGetResponse = CommonFunction.GetWebAPI(endpoint);

                if (HttpGetResponse != null)
                {
                    objAssetsAssignEmployeeViewModelList = JsonConvert.DeserializeObject <IEnumerable <AssetsAssignEmployeeViewModel> >(HttpGetResponse.Result).ToList();
                }
                else
                {
                    objAssetsAssignEmployeeViewModelList = Enumerable.Empty <AssetsAssignEmployeeViewModel>().ToList();

                    ModelState.AddModelError(string.Empty, "Server error. Please contact administrator.");
                }

                ////Generate List Of AssetsAssignment
                //IEnumerable<MasterAssetsAssignmentViewModel> objMasterAssetsAssignmentViewModelList = null;
                //endpoint = apiBaseUrl + "MasterAssetsAssignment";
                //Task<string> HttpGetResponseNew = CommonFunction.GetWebAPI(endpoint);

                //if (HttpGetResponseNew != null)
                //{
                //    objMasterAssetsAssignmentViewModelList = JsonConvert.DeserializeObject<IEnumerable<MasterAssetsAssignmentViewModel>>(HttpGetResponse.Result).ToList();
                //}
                //else
                //{
                //    objMasterAssetsAssignmentViewModelList = Enumerable.Empty<MasterAssetsAssignmentViewModel>().ToList();

                //    ModelState.AddModelError(string.Empty, "Server error. Please contact administrator.");
                //}



                objIndexMasterAssetsAssignmentViewModel.AssetsAssignEmployeeList = objAssetsAssignEmployeeViewModelList.ToList();

                //############# Profile Maping ###################
                CPanelManager.ViewModels.Account.ValidateAccountViewModel objValidateAccountViewModel = CommonFunction.ActionResultAuthentication(HttpContext, "/MasterEmployee/Index");

                if (objValidateAccountViewModel != null)
                {
                    objIndexMasterAssetsAssignmentViewModel.IsSelect = objValidateAccountViewModel.IsSelect;
                    objIndexMasterAssetsAssignmentViewModel.IsInsert = objValidateAccountViewModel.IsInsert;
                    objIndexMasterAssetsAssignmentViewModel.IsUpdate = objValidateAccountViewModel.IsUpdate;
                    objIndexMasterAssetsAssignmentViewModel.IsDelete = objValidateAccountViewModel.IsDelete;
                }
                //############# Profile Maping End ###################

                //Return View doesn't make a new requests, it just renders the view
                return(View("~/Views/Assets/MasterAssetsAssignment/Index.cshtml", objIndexMasterAssetsAssignmentViewModel));
            }
            catch (Exception ex)
            {
                string ActionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                string ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                string ErrorMessage   = "Controler:" + ControllerName + " , Action:" + ActionName + " , Exception:" + ex.Message;

                _logger.LogError(ErrorMessage);
                return(View("~/Views/Shared/Error.cshtml", CommonFunction.HandleErrorInfo(ex, ActionName, ControllerName)));
            }
            return(new EmptyResult());
        }
        public IActionResult PrintEmployeeAssetsAssignment()
        {
            try
            {
                IndexMasterAssetsAssignmentViewModel objIndexMasterAssetsAssignmentViewModel = new IndexMasterAssetsAssignmentViewModel();
                //Generate List Of Employees
                IEnumerable <AssetsAssignEmployeeViewModel> objAssetsAssignEmployeeViewModelList = null;
                string        endpoint        = apiBaseUrl + "MasterEmployees";
                Task <string> HttpGetResponse = CommonFunction.GetWebAPI(endpoint);

                if (HttpGetResponse != null)
                {
                    objAssetsAssignEmployeeViewModelList = JsonConvert.DeserializeObject <IEnumerable <AssetsAssignEmployeeViewModel> >(HttpGetResponse.Result).ToList();
                }
                else
                {
                    objAssetsAssignEmployeeViewModelList = Enumerable.Empty <AssetsAssignEmployeeViewModel>().ToList();

                    ModelState.AddModelError(string.Empty, "Server error. Please contact administrator.");
                }
                objIndexMasterAssetsAssignmentViewModel.AssetsAssignEmployeeList = objAssetsAssignEmployeeViewModelList.ToList();

                //Generate List Of AssetsAssignment
                IEnumerable <MasterAssetsAssignmentViewModel> objMasterAssetsAssignmentViewModelList = null;
                endpoint = assetsApiBaseUrl + "MasterAssetsAssignment/0";
                Task <string> HttpGetResponseNew = CommonFunction.GetWebAPI(endpoint);

                if (HttpGetResponseNew != null)
                {
                    objMasterAssetsAssignmentViewModelList = JsonConvert.DeserializeObject <IEnumerable <MasterAssetsAssignmentViewModel> >(HttpGetResponseNew.Result).ToList();
                }
                else
                {
                    objMasterAssetsAssignmentViewModelList = Enumerable.Empty <MasterAssetsAssignmentViewModel>().ToList();

                    ModelState.AddModelError(string.Empty, "Server error. Please contact administrator.");
                }
                objIndexMasterAssetsAssignmentViewModel.MasterAssetsAssignmentList = objMasterAssetsAssignmentViewModelList.ToList();

                string             filePath = $"{webHostEnvironment.WebRootPath}\\Reports\\EmployeeAssetsAssignment.pdf";
                System.IO.FileInfo DelFile  = new System.IO.FileInfo(filePath);

                if (DelFile.Exists)
                {
                    DelFile.Delete();
                }

                var report = new ViewAsPdf("~/Views/Assets/MasterAssetsAssignment/PrintEmployeeAssetsAssignment.cshtml", objIndexMasterAssetsAssignmentViewModel)
                {
                    MinimumFontSize = 10,
                    PageMargins     = { Left = 10, Bottom = 10, Right = 10, Top = 5 },
                    //FileName = filePath,//"EmployeeAssetsAssignment.pdf",
                    PageOrientation = Rotativa.AspNetCore.Options.Orientation.Portrait,
                    //CustomSwitches = "--page-offset 0 --footer-center [page] --footer-font-size 12",
                    CustomSwitches = "--footer-center \"  Created Date: " + DateTime.Now.Date.ToString("dd/MM/yyyy") + "  Page: [page]/[toPage]\"" +
                                     " --footer-line --footer-font-size \"10\" --footer-spacing 1 --footer-font-name \"Segoe UI\"",
                    PageSize = Rotativa.AspNetCore.Options.Size.A4,
                };

                return(report);
            }
            catch (Exception ex)
            {
                string ActionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                string ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                string ErrorMessage   = "Controler:" + ControllerName + " , Action:" + ActionName + " , Exception:" + ex.Message;

                _logger.LogError(ErrorMessage);
                return(View("~/Views/Shared/Error.cshtml", CommonFunction.HandleErrorInfo(ex, ActionName, ControllerName)));
            }
            return(new EmptyResult());
        }