public async Task <ActionResult> Create(TasksWeb.Models.Task task) { TaskRepository repository = new TaskRepository(); if (Request.HttpMethod == "POST") { TasksWeb.Models.Task newTask = await repository.CreateTask(task); return(Redirect("/")); } else { return(View(task)); } }
public async Task <ActionResult> View(string taskId) { TaskRepository repository = new TaskRepository(); TasksWeb.Models.Task contact = null; try { contact = await repository.GetTask(taskId); } catch (RedirectRequiredException x) { return(Redirect(x.RedirectUri.ToString())); } return(View(contact)); }
public async Task <ActionResult> Edit(string Id, TasksWeb.Models.Task task) { TaskRepository repository = new TaskRepository(); if (Request.HttpMethod == "POST") { await repository.UpdateTask(task); return(Redirect("/")); } else { task = await repository.GetTask(Id); return(View(task)); } }