Ejemplo n.º 1
0
        public ActionResult Create(ToDoList toDoList)
        {
            if (ModelState.IsValid)
            {
                toDoList.CreateDateTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"));
                _db.ToDoLists.Add(toDoList);
                _db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(toDoList);
        }
Ejemplo n.º 2
0
        public ActionResult Edit( ToDoList model)
        {
            var toDoList = _db.ToDoLists.Find(model.ToDoListId);
            toDoList.Title = model.Title;

            if (ModelState.IsValid)
            {
                _db.Entry(toDoList).State = EntityState.Modified;
                _db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(model);
        }