public async Task <IActionResult> Edit(int id, [Bind("ID,user_id,create_time,age,fourhurdle_time,fourhurdle_score")] FourhurdleAbilities fourhurdleAbilities) { if (id != fourhurdleAbilities.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(fourhurdleAbilities); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FourhurdleAbilitiesExists(fourhurdleAbilities.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(fourhurdleAbilities)); }
public FourhurdleList() { this.lastFourhurdle = new FourhurdleAbilities(); this.list = new List <FourhurdleAbilities>(); this.timelist = new List <string>(); this.numlist = new List <string>(); }
public async Task <IActionResult> Create([Bind("ID,user_id,create_time,age,fourhurdle_time")] FourhurdleAbilities fourhurdleAbilities, string type) { fourhurdleAbilities.create_time = DateTime.Now; var s = await _context.Fourhurdle_Score.SingleOrDefaultAsync(m => m.age == fourhurdleAbilities.age && m.num == fourhurdleAbilities.fourhurdle_time); fourhurdleAbilities.fourhurdle_score = s.score * 20 + 40; if (type == "yes") { _context.Add(fourhurdleAbilities); await _context.SaveChangesAsync(); } Result res = new Result(); res.num = fourhurdleAbilities.fourhurdle_score.ToString(); JsonResult result = Json(res); return(result); }