コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,NameKyrg,NameRus,CreateDate,DictStatusId,DeactiveDate")] DictMediaLangType dictMediaLangType)
        {
            if (id != dictMediaLangType.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(dictMediaLangType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DictMediaLangTypeExists(dictMediaLangType.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DictStatusId"] = new SelectList(_context.DictStatus, "Id", "Id", dictMediaLangType.DictStatusId);
            return(View(dictMediaLangType));
        }
コード例 #2
0
        // GET: GlobalDicts/DictMediaLangTypes/Create
        public IActionResult Create()
        {
            ViewData["DictStatusId"] = new SelectList(_context.DictStatus, "Id", "Name");
            DictMediaLangType model = new DictMediaLangType();

            model.CreateDate = DateTime.Now;
            return(View(model));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("Id,NameKyrg,NameRus,CreateDate,DictStatusId,DeactiveDate")] DictMediaLangType dictMediaLangType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(dictMediaLangType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DictStatusId"] = new SelectList(_context.DictStatus, "Id", "Name", dictMediaLangType.DictStatusId);
            return(View(dictMediaLangType));
        }