예제 #1
0
        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"));
        }
예제 #2
0
        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));
        }
예제 #3
0
        // 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));
        }