Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FeeCategoryId,GameCategoryId,FeeHD,FeeLD")] RefFee refFee)
        {
            if (id != refFee.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(refFee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RefFeeExists(refFee.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FeeCategoryId"]  = new SelectList(_context.Set <FeeCategory>(), "Id", "FeeCategoryName", refFee.FeeCategoryId);
            ViewData["GameCategoryId"] = new SelectList(_context.GameCategory, "Id", "GameCategoryName", refFee.GameCategoryId);
            return(View(refFee));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("Id,FeeCategoryId,GameCategoryId,FeeHD,FeeLD")] RefFee refFee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(refFee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FeeCategoryId"]  = new SelectList(_context.Set <FeeCategory>(), "Id", "FeeCategoryName", refFee.FeeCategoryId);
            ViewData["GameCategoryId"] = new SelectList(_context.GameCategory, "Id", "GameCategoryName", refFee.GameCategoryId);
            return(View(refFee));
        }