public async Task <IActionResult> Edit(int id, [Bind("Id,Title,CreateTime,LastUpdateTime")] CompetitionField competitionField) { if (id != competitionField.Id) { return(NotFound()); } if (ModelState.IsValid) { try { competitionField.LastUpdateTime = DateTime.Now; _context.Update(competitionField); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CompetitionFieldExists(competitionField.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(competitionField)); }
public async Task <IActionResult> Create([Bind("Id,Title,CreateTime,LastUpdateTime")] CompetitionField competitionField) { if (ModelState.IsValid) { competitionField.CreateTime = DateTime.Now; _context.Add(competitionField); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(competitionField)); }