public StudentManageController(ActivityReceiverDbContext arDbContext, UserManager <ApplicationUser> userManager, RoleManager <IdentityRole> roleManager)
        {
            _arDbContext = arDbContext;
            _userManager = userManager;
            _roleManager = roleManager;

            _dataBuilder = new StudentManageDataBuilder(_arDbContext, _userManager, _roleManager);
        }
Пример #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ApplicationDbContext appDbContext, ActivityReceiverDbContext arDbContext, IDbContextInitializer dbContextInitializer)
        {
            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            app.UseAuthentication();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            // Initialize Database
            dbContextInitializer.ApplicationDbContextInitialize().Wait();
            dbContextInitializer.MainDbContextInitialize().Wait();

            // Auto Mapper
            AutoMapper.Mapper.Initialize(cfg => {
                /* QuestionManage */
                // Index
                cfg.CreateMap <Question, ActivityReceiver.ViewModels.QuestionManage.QuestionPresenter>();
                // Create
                cfg.CreateMap <ActivityReceiver.ViewModels.QuestionManage.QuestionManageCreatePostViewModel, Question>();
                cfg.CreateMap <ActivityReceiver.ViewModels.QuestionManage.QuestionManageCreatePostViewModel, ActivityReceiver.ViewModels.QuestionManage.QuestionManageCreateGetViewModel>();
                // Edit
                cfg.CreateMap <Question, ActivityReceiver.ViewModels.QuestionManage.QuestionManageEditGetViewModel>();
                cfg.CreateMap <ActivityReceiver.ViewModels.QuestionManage.QuestionManageEditPostViewModel, Question>()
                .ForMember(dest => dest.CreateDate, opt => opt.Ignore())
                .ForMember(dest => dest.EditorID, opt => opt.Ignore());
                cfg.CreateMap <ActivityReceiver.ViewModels.QuestionManage.QuestionManageEditPostViewModel, ActivityReceiver.ViewModels.QuestionManage.QuestionManageEditGetViewModel>();
                // Details
                cfg.CreateMap <Question, ActivityReceiver.ViewModels.QuestionManage.QuestionManageDetailsViewModel>();
                // Delete
                cfg.CreateMap <Question, ActivityReceiver.ViewModels.QuestionManage.QuestionManageDeleteGetViewModel>();
                cfg.CreateMap <ActivityReceiver.ViewModels.QuestionManage.QuestionManageDeletePostViewModel, ActivityReceiver.ViewModels.QuestionManage.QuestionManageDeleteGetViewModel>();

                /* AnswerRepaly */
                //cfg.CreateMap<Movement,ActivityReceiver.ViewModels.AnswerReplay.>();
                //cfg.CreateMap<DeviceAcceleration, DeviceAccelerationDTO>();


                /* AnswerRecordManage*/
                cfg.CreateMap <AnswerRecord, ActivityReceiver.ViewModels.AnswerRecordManage.AnswerRecordPresenter>();
                // Details
                cfg.CreateMap <AnswerRecord, ActivityReceiver.ViewModels.AnswerRecordManage.AnswerRecordManageDetailsViewModel>();


                /* AssignmentManage */
                cfg.CreateMap <AnswerRecord, ActivityReceiver.ViewModels.AssignmentRecordManage.AnswerRecordPresenter>();
                // Index
                cfg.CreateMap <AssignmentRecord, ActivityReceiver.ViewModels.AssignmentRecordManage.AssignmentRecordPresenter>();
                // Details
                cfg.CreateMap <AssignmentRecord, ActivityReceiver.ViewModels.AssignmentRecordManage.AssignmentRecordManageDetailsViewModel>();

                /* ExerciseManage */
                // Index
                cfg.CreateMap <Exercise, ActivityReceiver.ViewModels.ExerciseManage.ExercisePresenter>();
                // Create
                cfg.CreateMap <ActivityReceiver.ViewModels.ExerciseManage.ExerciseManageCreatePostViewModel, Exercise>();
                cfg.CreateMap <ActivityReceiver.ViewModels.ExerciseManage.ExerciseManageCreatePostViewModel, ActivityReceiver.ViewModels.ExerciseManage.ExerciseManageCreateGetViewModel>();
                // Edit
                cfg.CreateMap <Exercise, ActivityReceiver.ViewModels.ExerciseManage.ExerciseManageEditGetViewModel>();
                cfg.CreateMap <ActivityReceiver.ViewModels.ExerciseManage.ExerciseManageEditPostViewModel, Exercise>()
                .ForMember(dest => dest.CreateDate, opt => opt.Ignore())
                .ForMember(dest => dest.EditorID, opt => opt.Ignore());
                cfg.CreateMap <ActivityReceiver.ViewModels.ExerciseManage.ExerciseManageEditPostViewModel, ActivityReceiver.ViewModels.ExerciseManage.ExerciseManageEditGetViewModel>();
                // Details
                cfg.CreateMap <Exercise, ActivityReceiver.ViewModels.ExerciseManage.ExerciseManageDetailsViewModel>();
                // Delete
                cfg.CreateMap <Exercise, ActivityReceiver.ViewModels.ExerciseManage.ExerciseManageDeleteGetViewModel>();
                cfg.CreateMap <ActivityReceiver.ViewModels.ExerciseManage.ExerciseManageDeletePostViewModel, ActivityReceiver.ViewModels.ExerciseManage.ExerciseManageDeleteGetViewModel>();

                /* StudentManage */
                // Index
                cfg.CreateMap <ApplicationUser, ActivityReceiver.ViewModels.StudentManage.StudentPresenter>();

                /* DataTransferObject */
                // MovementSupervised
                cfg.CreateMap <Movement, ActivityReceiver.DataTransferObjects.MovementSupervised>();
            });
        }
 public MobileApplicationController(ActivityReceiverDbContext arDbContext, UserManager <ApplicationUser> userManager)
 {
     _arDbContext = arDbContext;
     _userManager = userManager;
 }
Пример #4
0
 public ExerciseManageDataBuilder(ActivityReceiverDbContext arDbContext, UserManager <ApplicationUser> userManager, RoleManager <IdentityRole> roleManager)
 {
     _arDbContext = arDbContext;
     _userManager = userManager;
     _roleManager = roleManager;
 }
Пример #5
0
 public AnswerRecordReplayController(ActivityReceiverDbContext arDbContext, UserManager <ApplicationUser> userManager)
 {
     _arDbContext = arDbContext;
     _userManager = userManager;
 }
 public BehaviorController(ActivityReceiverDbContext arDbContext)
 {
     _arDbContext = arDbContext;
 }
 public AssignmentRecordManageDataBulider(ActivityReceiverDbContext arDbContext, UserManager <ApplicationUser> userManager, RoleManager <IdentityRole> roleManager)
 {
     _arDbContext = arDbContext;
     _userManager = userManager;
     _roleManager = roleManager;
 }
Пример #8
0
 public HomeController(ActivityReceiverDbContext arDbContext, UserManager <ApplicationUser> userManager, RoleManager <IdentityRole> roleManager)
 {
     _arDbContext = arDbContext;
     _userManager = userManager;
     _roleManager = roleManager;
 }