public ActionResult SaveInfoType(InfoType infoType) { if (ModelState.IsValid) { infoType.Id = Guid.NewGuid(); repository.SaveInfoType(infoType); return Redirect("Index"); } else { return View("EditinfoType", infoType); } }
public ActionResult SaveInfoType(InfoType infoType) { if (ModelState.IsValid) { using (var session = sessionFactory.OpenSession()) using (var tx = session.BeginTransaction()) { session.SaveOrUpdate(infoType); tx.Commit(); } return Redirect("Index"); } else { return View("EditinfoType", infoType); } }
public void SaveInfoType(InfoType infoType) { context.InfoType.Add(infoType); context.SaveChanges(); }