public async Task <ActionResult> DeleteConfirmed(int id) { TODO.domain.Entities.Task task = await db.Tasks.FindAsync(id); db.Tasks.Remove(task); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "TaskId,Name,Priority,Date,Comment,IsCompleted")] TODO.domain.Entities.Task task) { if (ModelState.IsValid) { db.Entry(task).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(task)); }
// GET: Tasks/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TODO.domain.Entities.Task task = await db.Tasks.FindAsync(id); if (task == null) { return(HttpNotFound()); } return(View(task)); }