Пример #1
0
        public HallSandBox(GameControls.PageControl BackingForm, SandBoxBase myFrontSandBoxValue,
                           HallSandBoxMode myMode,
                           CustomDesign myCustomDesignValue,
                           bool useAnimationValue = true, EventHandler eventAfterEndingTheAnimation = null) :
            base(BackingForm, myCustomDesignValue)
        {
            MyFrontSandBox = myFrontSandBoxValue;
            Mode           = SandBoxMode.HallSandBoxMode;
            HallMode       = myMode;
            UseAnimation   = useAnimationValue;
            CustomDesign   = myCustomDesignValue;
            EventAfterEndingTheAnimation = eventAfterEndingTheAnimation;
            switch (HallMode)
            {
            case HallSandBoxMode.HallOfBookStoryMode:
                Initialize_HallOfStory_Component();
                break;

            case HallSandBoxMode.HallOfElementMode:
                Initialize_HallOfElements_Component();
                break;

            default:
                break;
            }

            Show();
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,CompanyType,CategoryType,Description")] CustomDesign customDesign)
        {
            if (id != customDesign.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customDesign);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomDesignExists(customDesign.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryType"] = new SelectList(_context.Categories, "Category1", "Category1", customDesign.CategoryType);
            ViewData["CompanyType"]  = new SelectList(_context.Companies, "Name", "Name", customDesign.CompanyType);
            return(View(customDesign));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,CompanyType,CategoryType,Description")] CustomDesign customDesign)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customDesign);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryType"] = new SelectList(_context.Categories, "Category1", "Category1", customDesign.CategoryType);
            ViewData["CompanyType"]  = new SelectList(_context.Companies, "Name", "Name", customDesign.CompanyType);
            return(View(customDesign));
        }