private void SaveTask() { PtNewTask taskNew = new PtNewTask { ItemId = Item.Id, Title = NewTaskTitle }; RpsTasksRepo.AddNewTask(taskNew); }
private void SaveTask() { PtNewTask taskNew = new PtNewTask { ItemId = TasksFormVm.ItemId, Title = TasksFormVm.NewTaskTitle }; rpsTasksRepo.AddNewTask(taskNew); }
public PtTask AddNewTask(PtNewTask newTask) { var item = context.PtItems.Single(i => i.Id == newTask.ItemId); PtTask task = new PtTask { Id = item.Tasks.Max(t => t.Id) + 1, Title = newTask.Title, Completed = false, DateCreated = DateTime.Now, DateModified = DateTime.Now }; item.Tasks.Insert(0, task); return(task); }
public ActionResult Tasks(int id, PtItemTasksVm vm) { ViewBag.screen = DetailScreenEnum.Tasks; try { PtNewTask taskNew = new PtNewTask { ItemId = id, Title = vm.NewTaskTitle }; rpsTasksRepo.AddNewTask(taskNew); return(RedirectToAction("Tasks")); } catch { return(RedirectToAction("Tasks")); } }