public async Task <IActionResult> PutRun([FromRoute] int id, [FromBody] Run run) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != run.Id) { return(BadRequest()); } _context.Entry(run).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RunExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
//[ValidateAntiForgeryToken] public async Task <IActionResult> Create([Bind("Id,Username,Email,Firstname,Lastname,ProfilePicture,Status")] Player playerModel) { if (ModelState.IsValid) { _context.Add(playerModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(playerModel)); }
public async Task <IActionResult> Create([Bind("Id,Line1,Line2,City,state,ZipCode")] Address addressModel) { if (ModelState.IsValid) { _context.Add(addressModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(addressModel)); }
public async Task <IActionResult> Create( [Bind("Id,Username,Email,Firstname,Lastname,Status")] UserModel userModel) { if (ModelState.IsValid) { _context.Add(userModel); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(userModel)); }