public async Task <ActionResult> DeleteConfirmed(int id) { MyCompetition myCompetition = await db.MyCompetitions.FindAsync(id); db.MyCompetitions.Remove(myCompetition); await db.SaveChangesAsync(); return(RedirectToAction("Competitions")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Name,Date,Distance,Description,Link,DaysLeft")] MyCompetition myCompetition) { if (ModelState.IsValid) { db.Entry(myCompetition).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Competitions")); } return(View(myCompetition)); }
public async Task <ActionResult> Create([Bind(Include = "Id,Name,Date,Distance,Description,DaysLeft")] MyCompetition myCompetition) { if (ModelState.IsValid) { db.MyCompetitions.Add(myCompetition); await db.SaveChangesAsync(); return(RedirectToAction("Competitions")); } return(View(myCompetition)); }
// GET: MyCompetitions/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MyCompetition myCompetition = await db.MyCompetitions.FindAsync(id); if (myCompetition == null) { return(HttpNotFound()); } return(View(myCompetition)); }
// GET: MyCompetitions public async Task <ActionResult> Competitions(MyCompetition myCompetition) { //myCompetition.Date = myCompetition.Date.Date; return(View(await db.MyCompetitions.ToListAsync())); }