public ActionResult AddTask(int id) { if (id == 0) id = RouteData.Values["id"] as int? ?? 0; var model = new AddTaskViewModel(); model.BundleId = id; return View(model); }
public ActionResult AddTask(AddTaskViewModel model) { var task = new DAL.Task() { bundle_id = model.BundleId, task_type_id = model.TypeId, task_name = model.Name, TaskType = bundleService.GetTaskTypeWithId(model.TypeId), Bundle = bundleService.GetBundleWithId(model.BundleId) }; var new_task = bundleService.AddTask(task); return RedirectToAction("TaskDetail", new { id = new_task.id }); }