public async Task <IActionResult> Edit(int id, [Bind("LPRId,LPRName,LPRRange")] LPR lPR) { if (id != lPR.LPRId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(lPR); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LPRExists(lPR.LPRId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(lPR)); }
public ActionResult DeleteConfirmed(int id) { LPR lPR = db.LPR.Find(id); db.LPR.Remove(lPR); db.SaveChanges(); return(RedirectToAction("Index")); }
public IActionResult UpdateJudge(int LNum, string judgeName) { LPR lpr = db.LPRs.First(x => x.LNum == LNum); lpr.LName = judgeName; db.LPRs.Update(lpr); db.SaveChanges(); return(RedirectToAction("Index")); }
public IActionResult AddJudge(string judgeName) { LPR newJudge = new LPR(); newJudge.LName = judgeName; newJudge.LRange = 1; db.LPRs.Add(newJudge); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "IdLPR,LName,LRange")] LPR lPR) { if (ModelState.IsValid) { db.Entry(lPR).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(lPR)); }
public ActionResult Create([Bind(Include = "IdLPR,LName,LRange")] LPR lPR) { if (ModelState.IsValid) { db.LPR.Add(lPR); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(lPR)); }
// GET: LPRs/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LPR lPR = db.LPR.Find(id); if (lPR == null) { return(HttpNotFound()); } return(View(lPR)); }
public async Task <IActionResult> Create(int id) { var LPR = new LPR(); LPR.LPRName = User.Identity.Name; LPR.LPRRange = int.Parse(Request.Form.FirstOrDefault(x => x.Key == "LPRRange").Value[0]); if (ModelState.IsValid && _context.LPR.Select(x => x.LPRName).ToList().IndexOf(LPR.LPRName) == -1) { _context.Add(LPR); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View()); }
public async Task <IActionResult> OnPostAsync(string returnUrl = null) { returnUrl = returnUrl ?? Url.Content("~/"); if (ModelState.IsValid) { var user = new LPR { UserName = Input.UserName }; var result = await _userManager.CreateAsync(user, Input.Password); if (result.Succeeded) { _logger.LogInformation("User created a new account with password."); var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); var callbackUrl = Url.Page( "/Account/ConfirmEmail", pageHandler: null, values: new { userId = user.Id, code = code }, protocol: Request.Scheme); //await _emailSender.SendEmailAsync(Input.Email, "Confirm your email", // $"Please confirm your account by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>."); await _signInManager.SignInAsync(user, isPersistent : false); return(LocalRedirect(returnUrl)); } foreach (var error in result.Errors) { ModelState.AddModelError(string.Empty, error.Description); } } // If we got this far, something failed, redisplay form return(Page()); }
public IActionResult EditJudge(int LNum) { LPR lpr = db.LPRs.First(x => x.LNum == LNum); return(View(lpr)); }