コード例 #1
0
        public async Task <ActionResult> DeleteAsync(int id)
        {
            var item = await userTask.GetTaskId(id);

            if (item == null)
            {
                TempData["Error"] = "The item does not exist!";
            }
            else
            {
                await userTask.DeleteTask(item);

                TempData["Success"] = "The item has been deleted!";
            }

            return(RedirectToAction("Index"));
        }