Пример #1
0
        public async Task <IActionResult> Create([Bind("Id,Description,Ip,ReloadDate")] Server server)
        {
            if (ModelState.IsValid)
            {
                _context.Add(server);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(server));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("Id,ServerId,Text,ProcessingDate,Type,Priority,LoadLevel")] Message message)
        {
            if (ModelState.IsValid)
            {
                _context.Add(message);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.Types        = new SelectList(func.TypeList.AsEnumerable());
            ViewData["ServerId"] = new SelectList(_context.Set <Server>(), "Id", "Id", message.ServerId);
            return(View(message));
        }