Esempio n. 1
0
 public IActionResult EnhancementSelection(EnhancementSelectionList esl)
 {
     for (int i = 0; i < esl.enhancement_list.Count(); i++)
     {
         if (esl.selection_list[i] == true)
         {
             enh_reg_repository.AddEnhancementRegistration(
                 new EnhancementRegistration
             {
                 Enr_Cst_Code = esl.srk.Cst_Code,
                 Enr_Sys_Code = esl.srk.Sys_Code,
                 Enr_Ver_Code = esl.srk.Ver_Code,
                 Enr_Mod_Code = esl.Mod_Code,
                 Enr_Enh_Code = esl.enhancement_list[i].Enh_Code
             });
         }
         else
         {
             enh_reg_repository.DeleteEnhancementRegistration(esl.srk.Cst_Code,
                                                              esl.srk.Sys_Code,
                                                              esl.srk.Ver_Code,
                                                              esl.Mod_Code,
                                                              esl.enhancement_list[i].Enh_Code);
         }
     }
     return(View(nameof(Index),
                 sys_reg_repository.SystemRegistrations.FirstOrDefault(r => r.Syr_Cst_Code == esl.srk.Cst_Code &&
                                                                       r.Syr_Sys_Code == esl.srk.Sys_Code &&
                                                                       r.Syr_Ver_Code == esl.srk.Ver_Code)));
 }
Esempio n. 2
0
        public IActionResult EnhancementSelection(EnhancementSelectionList esl)
        {
            bool add_system_registration = true;

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

                    enh_reg_repository.AddEnhancementRegistration(
                        new EnhancementRegistration
                    {
                        Enr_Cst_Code = esl.srk.Syr_Cst_Code,
                        Enr_Sys_Code = esl.srk.Syr_Sys_Code,
                        Enr_Ver_Code = esl.srk.Syr_Ver_Code,
                        Enr_Mod_Code = esl.Mod_Code,
                        Enr_Enh_Code = esl.enhancement_list[i].Enh_Code
                    });
                }
                else
                {
                    enh_reg_repository.DeleteEnhancementRegistration(esl.srk.Syr_Cst_Code,
                                                                     esl.srk.Syr_Sys_Code,
                                                                     esl.srk.Syr_Ver_Code,
                                                                     esl.Mod_Code,
                                                                     esl.enhancement_list[i].Enh_Code);
                }
            }

            return(RedirectToAction(nameof(SystemRegistrationForm), new
            {
                cst_code = esl.srk.Syr_Cst_Code,
                sys_code = esl.srk.Syr_Sys_Code,
                ver_code = esl.srk.Syr_Ver_Code,
                mod_code = esl.Mod_Code,
                cur_tab = "Enhancement"
            }));
        }