public static void CreateTask(TodoTask task) { using (TodoContext ctx = new TodoContext()) { ctx.Tasks.Add(task); ctx.SaveChanges(); } }
public ActionResult CreateTask(TodoTask task) { if (ModelState.IsValid) { TasksBL.CreateTask(task); return RedirectToAction("Index", "Home"); } return View(); }
public static void CreateTask(TodoTask task) { task.CreatedDate = DateTime.Now; task.Status = TodoTaskStatus.New; TasksDAL.CreateTask(task); }