コード例 #1
0
        public async Task <ActionResult> Index(SecurityInfoViewModel model, CancellationToken cancellationToken)
        {
            if (!ModelState.IsValid)
            {
                ViewData[Constant.CustomSuccessMessage] = Constant.CustomValidationErrorMessage;
                ViewData[Constant.QuerySuccess]         = false;
                model = (SecurityInfoViewModel)await _service.IndexAsync(this.HttpContext.ApplicationInstance.Context, GetCanellationToken(cancellationToken));

                return(View(model));
            }
            ModelState.Clear();
            model = (SecurityInfoViewModel)await _service.UpdateAsync(this.HttpContext.ApplicationInstance.Context, model, GetCanellationToken(cancellationToken));

            ViewData[Constant.QuerySuccess] = HttpContext.Items[Constant.QuerySuccess];
            ViewData[Constant.FormTitle]    = HttpContext.Items[Constant.FormTitle];
            if (System.Convert.ToBoolean(ViewData[Constant.QuerySuccess]))

            {
                ViewData[Constant.FormTitle] = "EDIT Security Info";
            }
            if (!System.Convert.ToBoolean(ViewData[Constant.QuerySuccess]))
            {
                ViewData[Constant.CustomSuccessMessage] = "Error : Record cannot be Saved.";
            }
            return(View(model));
        }
コード例 #2
0
        public async Task <ISecurityInfoViewModel> UpdateAsync(HttpContext context, SecurityInfoViewModel model, CancellationToken cancellationToken)
        {
            long securityQuestionId = 0;

            model.UserId  = context.User.Identity.GetUserId();
            model.EmailId = Convert.ToString(context.Session[Constant.EmailId]);

            context.Items[Constant.QuerySuccess] = Convert.ToBoolean(await _dal.UpdateAsync(model, cancellationToken));
            model.DDLSecurityQuestion            = _ddlDAL.GetSecurityQuestionList(Convert.ToInt64(model.UserId), ref securityQuestionId, false);
            return(model);
        }
コード例 #3
0
        public async override Task <ISecurityInfoViewModel> IndexAsync(HttpContext context, CancellationToken cancellationToken)
        {
            long securityQuestionId      = 0;
            ISecurityInfoViewModel model = new SecurityInfoViewModel();

            model.DDLSecurityQuestion = _ddlDAL.GetSecurityQuestionList(userId, ref securityQuestionId, false);
            model.Answer             = "";
            model.SecurityQuestionId = securityQuestionId;

            return(model);
        }
コード例 #4
0
        public ViewModelLocator()
        {
            try
            {
                var config = new ConfigurationBuilder();
                config.AddJsonFile("autofac.json");
                var module  = new ConfigurationModule(config.Build());
                var builder = new ContainerBuilder();
                builder.RegisterModule(module);
                Container = builder.Build();

                navigationService           = Container.Resolve <INavigationService>();
                mainWindowViewModel         = Container.Resolve <MainWindowViewModel>();
                infrastructureListViewModel = Container.Resolve <InfrastructureListViewModel>();
                infrastructureInfoViewModel = Container.Resolve <InfrastructureInfoViewModel>();
                problemsViewModel           = Container.Resolve <ProblemsViewModel>();
                buildingListViewModel       = Container.Resolve <BuildingListViewModel>();
                governmentListViewModel     = Container.Resolve <GovernmentListViewModel>();
                helloViewModel                 = Container.Resolve <HelloViewModel>();
                hospitalsListViewModel         = Container.Resolve <HospitalsListViewModel>();
                ideaListViewModel              = Container.Resolve <IdeaListViewModel>();
                importantViewModel             = Container.Resolve <ImportantViewModel>();
                newsViewModel                  = Container.Resolve <NewsViewModel>();
                publicTransportListViewModel   = Container.Resolve <PublicTransportListViewModel>();
                roadListViewModel              = Container.Resolve <RoadListViewModel>();
                securityListViewModel          = Container.Resolve <SecurityListViewModel>();
                trade_AdvertisingListViewModel = Container.Resolve <Trade_AdvertisingListViewModel>();
                yardListViewModel              = Container.Resolve <YardListViewModel>();
                buildingInfoViewModel          = Container.Resolve <BuildingInfoViewModel>();
                governmentInfoViewModel        = Container.Resolve <GovernmentInfoViewModel>();
                hospitalsInfoViewModel         = Container.Resolve <HospitalsInfoViewModel>();
                ideaInfoViewModel              = Container.Resolve <IdeaInfoViewModel>();
                publicTransportInfoViewModel   = Container.Resolve <PublicTransportInfoViewModel>();
                roadInfoViewModel              = Container.Resolve <RoadInfoViewModel>();
                securityInfoViewModel          = Container.Resolve <SecurityInfoViewModel>();
                trade_AdvertisingInfoView      = Container.Resolve <Trade_AdvertisingInfoViewModel>();
                yardInfoViewModel              = Container.Resolve <YardInfoViewModel>();

                navigationService.Register <InfrastructureListViewModel>(infrastructureListViewModel);
                navigationService.Register <InfrastructureInfoViewModel>(infrastructureInfoViewModel);
                navigationService.Register <ProblemsViewModel>(problemsViewModel);
                navigationService.Register <BuildingListViewModel>(buildingListViewModel);
                navigationService.Register <GovernmentListViewModel>(governmentListViewModel);
                navigationService.Register <HelloViewModel>(helloViewModel);
                navigationService.Register <HospitalsListViewModel>(hospitalsListViewModel);
                navigationService.Register <IdeaListViewModel>(ideaListViewModel);
                navigationService.Register <ImportantViewModel>(importantViewModel);
                navigationService.Register <NewsViewModel>(newsViewModel);
                navigationService.Register <PublicTransportListViewModel>(publicTransportListViewModel);
                navigationService.Register <RoadListViewModel>(roadListViewModel);
                navigationService.Register <SecurityListViewModel>(securityListViewModel);
                navigationService.Register <Trade_AdvertisingListViewModel>(trade_AdvertisingListViewModel);
                navigationService.Register <YardListViewModel>(yardListViewModel);
                navigationService.Register <BuildingInfoViewModel>(buildingInfoViewModel);
                navigationService.Register <GovernmentInfoViewModel>(governmentInfoViewModel);
                navigationService.Register <HospitalsInfoViewModel>(hospitalsInfoViewModel);
                navigationService.Register <IdeaInfoViewModel>(ideaInfoViewModel);
                navigationService.Register <PublicTransportInfoViewModel>(publicTransportInfoViewModel);
                navigationService.Register <RoadInfoViewModel>(roadInfoViewModel);
                navigationService.Register <SecurityInfoViewModel>(securityInfoViewModel);
                navigationService.Register <Trade_AdvertisingInfoViewModel>(trade_AdvertisingInfoView);
                navigationService.Register <YardInfoViewModel>(yardInfoViewModel);

                navigationService.Navigate <HelloViewModel>();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }