Example #1
0
        public IActionResult Index()
        {
            ProfileMenuRightsViewModel objProfileMenuRightsViewModel = HttpContext.Session.GetObjectFromJson <ProfileMenuRightsViewModel>("MenuDetail");


            //DashboardAdminViewModel objDashboardAdminViewModel = new DashboardAdminViewModel();

            DashboardAdminViewModel objDashboardAdminViewModel = null;
            string        endpoint        = assetsApiBaseUrl + "Dashboard?MasterSubCategoryId=0&MasterBranchId=0";
            Task <string> HttpGetResponse = CommonFunction.GetWebAPI(endpoint);

            if (HttpGetResponse != null)
            {
                objDashboardAdminViewModel = JsonConvert.DeserializeObject <DashboardAdminViewModel>(HttpGetResponse.Result);
            }
            else
            {
                objDashboardAdminViewModel = new DashboardAdminViewModel();;

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

            //OtherDetail

            objDashboardAdminViewModel.CurrentDateTime      = DateTime.Now;
            objDashboardAdminViewModel.LastSuccessfullLogin = objProfileMenuRightsViewModel.LastSuccessfullLogin;
            objDashboardAdminViewModel.CompanyMasterName    = objProfileMenuRightsViewModel.MasterCompanyName;
            objDashboardAdminViewModel.LoginIP   = objProfileMenuRightsViewModel.LoginIP;
            objDashboardAdminViewModel.SessionId = objProfileMenuRightsViewModel.SessionId;

            return(View(objDashboardAdminViewModel));
        }
Example #2
0
        public IActionResult ViewMasterBranch(long MasterBranchId)
        {
            try
            {
                AddMasterBranchViewModel objAddMasterBranchViewModel = null;
                string        endpoint        = apiBaseUrl + "MasterBranches/" + MasterBranchId;
                Task <string> HttpGetResponse = CommonFunction.GetWebAPI(endpoint);

                if (HttpGetResponse != null)
                {
                    objAddMasterBranchViewModel = JsonConvert.DeserializeObject <AddMasterBranchViewModel>(HttpGetResponse.Result);
                }
                else
                {
                    objAddMasterBranchViewModel = new AddMasterBranchViewModel();
                    ModelState.AddModelError(string.Empty, "Server error. Please contact administrator.");
                }

                DropDownFillMethod();
                objAddMasterBranchViewModel.Mode = CommonFunction.Mode.UPDATE;



                DashboardAdminViewModel objDashboardAdminViewModel = null;
                endpoint = assetsApiBaseUrl + "Dashboard?MasterSubCategoryId=0&MasterBranchId=" + MasterBranchId;
                Task <string> HttpGetResponseProduct = CommonFunction.GetWebAPI(endpoint);

                if (HttpGetResponse != null)
                {
                    objDashboardAdminViewModel = JsonConvert.DeserializeObject <DashboardAdminViewModel>(HttpGetResponseProduct.Result);
                }
                else
                {
                    objDashboardAdminViewModel = new DashboardAdminViewModel();;

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

                objAddMasterBranchViewModel.ProductDetailResultList = objDashboardAdminViewModel.AssetsSubCategoryList.ToList();
                return(View("~/Views/Master/MasterBranch/AddMasterBranch.cshtml", objAddMasterBranchViewModel));
            }
            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());
        }