public ActionResult New(int id) { SQL.TMSMiscSQL miscSQL = new SQL.TMSMiscSQL(); var viewModel = new SubtaskLevel1ViewModel() { Prices = _context.Prices.ToList(), Members = _context.Members.ToList(), TaskStatuses = _context.TaskStatuses.ToList(), TaskId = id, TaskStatusId = 1, //Not started DateCreated = DateTime.Today, SubTaskOrder = miscSQL.GetCurrentSubTaskOrder(id) }; return(View("SubtaskLevel1FormNew", viewModel)); }
public ViewResult New(int taskId, int subTaskId) { var viewModel = new TaskProcedureViewModel(); SQL.TMSMiscSQL miscSQL = new SQL.TMSMiscSQL(); Tasks parentTask = _context.Tasks.FirstOrDefault(t => t.TaskId == taskId); SubTasksLevel1 parentSubTask = _context.SubTasksLevel1.FirstOrDefault(s => s.SubTaskId == subTaskId); viewModel.TaskId = taskId; viewModel.SubTaskId = subTaskId; viewModel.TaskName = parentTask.TaskName; viewModel.SubTaskName = parentSubTask.SubTaskName; viewModel.TaskProcedureOrder = miscSQL.GetCurrentTaskProcOrder(subTaskId) + 1; return(View("TaskProceduresForm", viewModel)); }