Example #1
0
 public IActionResult ModuleSelection(ModuleSelectionList msl)
 {
     for (int i = 0; i < msl.module_list.Count(); i++)
     {
         if (msl.selection_list[i] == true)
         {
             mod_reg_repository.AddModuleRegistration(
                 new ModuleRegistration
             {
                 Mor_Cst_Code = msl.srk.Cst_Code,
                 Mor_Sys_Code = msl.srk.Sys_Code,
                 Mor_Ver_Code = msl.srk.Ver_Code,
                 Mor_Mod_Code = msl.module_list[i].Mod_Code
             });
         }
         else
         {
             mod_reg_repository.DeleteModuleRegistration(msl.srk.Cst_Code,
                                                         msl.srk.Sys_Code,
                                                         msl.srk.Ver_Code,
                                                         msl.module_list[i].Mod_Code);
         }
     }
     return(View(nameof(Index),
                 sys_reg_repository.SystemRegistrations.FirstOrDefault(r => r.Syr_Cst_Code == msl.srk.Cst_Code &&
                                                                       r.Syr_Sys_Code == msl.srk.Sys_Code &&
                                                                       r.Syr_Ver_Code == msl.srk.Ver_Code)));
 }
Example #2
0
        public IActionResult ModuleSelection(ModuleSelectionList msl)
        {
            bool add_system_registration = true;

            for (int i = 0; i < msl.module_list.Count(); i++)
            {
                if (msl.selection_list[i] == true)
                {
                    if (add_system_registration)
                    {
                        if (!sys_reg_repository.SystemRegistrations.Any(r => r.Syr_Cst_Code == msl.srk.Syr_Cst_Code &&
                                                                        r.Syr_Sys_Code == msl.srk.Syr_Sys_Code &&
                                                                        r.Syr_Ver_Code == msl.srk.Syr_Ver_Code))
                        {
                            sys_reg_repository.AddSystemRegistration(msl.srk);
                            add_system_registration = false;
                        }
                    }

                    mod_reg_repository.AddModuleRegistration(
                        new ModuleRegistration
                    {
                        Mor_Cst_Code = msl.srk.Syr_Cst_Code,
                        Mor_Sys_Code = msl.srk.Syr_Sys_Code,
                        Mor_Ver_Code = msl.srk.Syr_Ver_Code,
                        Mor_Mod_Code = msl.module_list[i].Mod_Code
                    });
                }
                else
                {
                    mod_reg_repository.DeleteModuleRegistration(msl.srk.Syr_Cst_Code,
                                                                msl.srk.Syr_Sys_Code,
                                                                msl.srk.Syr_Ver_Code,
                                                                msl.module_list[i].Mod_Code);
                }
            }

            return(RedirectToAction(nameof(SystemRegistrationForm), new
            {
                cst_code = msl.srk.Syr_Cst_Code,
                sys_code = msl.srk.Syr_Sys_Code,
                ver_code = msl.srk.Syr_Ver_Code,
                mod_code = string.Empty,
                cur_tab = "Module"
            }));
        }