public async Task<ActionResult> Edit(string Id, SpTask task) { SpTaskRepository repository = new SpTaskRepository(); if (Request.HttpMethod == "POST") { await repository.UpdateTask(task); return Redirect("/"); } else { task = await repository.GetTask(Id); return View(task); } }