public ActionResult Create(Computer newComputer, HttpPostedFileBase file) { if (ModelState.IsValid) { newComputer.Photo = "/Images/" + System.IO.Path.GetFileName(file.FileName); db.ComputerList.Add(newComputer); db.SaveChanges(); ModelState.AddModelError("", "Add computer completed!"); } return(View()); }
public ActionResult Create(User newUser) { if (ModelState.IsValid) { newUser.Passcode = PasscodeSecurity.encPasscode(newUser.Passcode); db.Entry(newUser).State = EntityState.Added; db.SaveChanges(); ModelState.AddModelError("", "Add user completed!"); TempData["Msg"] = "Add user completed!"; } return(View()); }
public void Save() { _context.SaveChanges(); }