public async Task <IActionResult> Edit(int id, [Bind("Id,Remark")] TestCoin testcoin) { if (id != testcoin.Id) { return(NotFound()); } var item = _context.TestCoins.FirstOrDefault(p => p.Id == testcoin.Id); if (item != null) { try { item.Remark = testcoin.Remark; _context.Update(item); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TestCoinExists(testcoin.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(List))); } return(View(testcoin)); }
public async Task <IActionResult> Apply([Bind("Id,Name,Email,Phone,QQ,Company,Reason,NeoCount,GasCount,PubKey,Remark")] TestCoin testcoin) { if (ModelState.IsValid) { if (_context.TestCoins.Any(p => p.PubKey == testcoin.PubKey)) { ModelState.AddModelError("PubKey", _localizer["Please do not repeat the request."]); return(View()); } if (!Helper.CCAttack(_accessor.HttpContext.Connection.RemoteIpAddress, "testcoin_apply", 86400, 5)) { return(Content("Protecting from overposting attacks now!")); } testcoin.Time = DateTime.Now; _context.Add(testcoin); await _context.SaveChangesAsync(); return(View("completed")); } return(View(testcoin)); }