// GET: /Tasks/Create with Project Id public virtual ActionResult Create(int? projectId) { TaskEdit model; if (projectId == null || projectId == 0) { model = new TaskEdit { Projects = ProjectService.GetAll(Query.ForProject()) .Select(x => new SelectListItem { Value = x.ProjectId.ToString(), Text = x.Name, //Selected = }).ToList() }; } else { model = new TaskEdit { ProjectId = projectId.Value }; } return CreateEditView(model); }
public virtual ActionResult PendingTask(TaskEdit model) { return Handle(model, TaskService.Save, () => RedirectToAction(MVC.Tasks.PendingTaskView()), RedirectToAction(MVC.Tasks.Views.PendingTaskCreate)); }
private ActionResult CreateEditView(TaskEdit model) { ViewBag.EmployeesList = new SelectList(EmployeeService.GetAll(Query.ForEmployee()), "EmployeeId", "FullName"); if (model.ProjectId != 0) { var project = ProjectService.GetByIdEx(model.ProjectId, new ProjectInclude().Customer()); ViewBag.Project = project; model.ProjectName = project.Name; } return View(model); }
public virtual ActionResult PendingTask() { var projects = ProjectService.GetAll(Query.ForProject().Filter(x => x.ByCustomerId(UserCustomerId ?? 1))); if (projects == null) { return HttpNotFound(); } var projectsList = projects.Select(x => new SelectListItem() { Text = x.Name, Value = x.ProjectId.ToString() }).ToList(); var model = new TaskEdit(); ViewBag.Projects = projectsList; return View(MVC.Tasks.Views.PendingTaskCreate, model); }
public virtual ActionResult Edit(TaskEdit model) { ActionResult result = null; result = RedirectToAction(model.TaskId !=0 ? MVC.Tasks.Edit(model.TaskId) : MVC.Tasks.Create(model.ProjectId)); return Handle(model, TaskService.Save, () => RedirectToAction(MVC.Tasks.View(model.TaskId)), () => model.ProjectId == 0 ? RedirectToAction(MVC.Tasks.Create(model.ProjectId)) : result); }