예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,NameKyrg,NameRus,CreateDate,DictStatusId,DeactiveDate")] DictControlType dictControlType)
        {
            if (id != dictControlType.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(dictControlType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DictControlTypeExists(dictControlType.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DictStatusId"] = new SelectList(_context.DictStatus, "Id", "Name", dictControlType.DictStatusId);
            return(View(dictControlType));
        }
예제 #2
0
        // GET: GlobalDicts/DictControlTypes/Create
        public IActionResult Create()
        {
            ViewData["DictStatusId"] = new SelectList(_context.DictStatus, "Id", "Name");
            DictControlType model = new DictControlType();

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

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