Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Remark")] Testnet testnet)
        {
            if (id != testnet.Id)
            {
                return(NotFound());
            }
            var item = _context.Testnets.FirstOrDefault(p => p.Id == testnet.Id);

            if (item != null)
            {
                try
                {
                    item.Remark = testnet.Remark;
                    _context.Update(item);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TestnetExists(testnet.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(List)));
            }
            return(View(testnet));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Email,Phone,QQ,Company,Reason,ANSCount,ANCCount,PubKey,Remark")] Testnet testnet)
        {
            if (ModelState.IsValid)
            {
                if (_context.Testnets.Any(p => p.PubKey == testnet.PubKey))
                {
                    ModelState.AddModelError("PubKey", _localizer["Please do not repeat the request."]);
                    return(View());
                }
                testnet.Time = DateTime.Now;
                _context.Add(testnet);
                await _context.SaveChangesAsync();

                return(View("completed"));
            }
            return(View(testnet));
        }