public ActionResult Create(Todo todo) { todo.LastModified = DateTime.Now; _ctx.Todos.Add(todo); _ctx.SaveChanges(); return PartialView("_Created", todo); }
public ActionResult Edit(int id, Todo todo) { var updated = _ctx.Todos.Where(w => w.Id == id).FirstOrDefault(); if (todo.Description != null) { UpdateModel(updated); updated.LastModified = DateTime.Now; _ctx.SaveChanges(); } return PartialView("_Edited", updated); }