public async Task <IActionResult> Edit(int id, [Bind("ID,ClassName,Type,DuringTime,BurnCalories")] StudioClass studioClass) { if (id != studioClass.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(studioClass); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudioClassExists(studioClass.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(studioClass)); }
public async Task <IActionResult> Create([Bind("ID,ClassName,Type,DuringTime,BurnCalories")] StudioClass studioClass) { if (ModelState.IsValid) { _context.Add(studioClass); //FacebookAPI facebook(studioClass.ClassName); //FacebookAPI await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(studioClass)); }