public ActionResult Create(DeviceModel devicemodel) { if (ModelState.IsValid) { devicemodel.CreateTime = DevTools.GetNowDateTime(); devicemodel.ModifyTime = devicemodel.CreateTime; db.DeviceModels.Add(devicemodel); db.SaveChanges(); return RedirectToAction("Index"); } return View(devicemodel); }
public ActionResult Edit(DeviceModel devicemodel) { if (ModelState.IsValid) { devicemodel.ModifyTime = DevTools.GetNowDateTime(); db.Entry(devicemodel).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(devicemodel); }