Пример #1
0
        public ActionResult Create(Regime regime)
        {
            if (!Authorization.GetAccess(table, HttpContext.User.Identity.Name, write))
                return RedirectToAction("Index", "Home");

            if (ModelState.IsValid)
            {
                regime.ID = Guid.NewGuid();
                regime.CreatedBy = Guid.Parse(Session["userid"].ToString());
                regime.CreatedOn = DateTime.Now;
                db.Regimes.AddObject(regime);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.CreatedBy = new SelectList(db.Users, "ID", "UserName", regime.CreatedBy);
            ViewBag.ModifiedBy = new SelectList(db.Users, "ID", "UserName", regime.ModifiedBy);
            return View(regime);
        }
Пример #2
0
 /// <summary>
 /// Create a new Regime object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="regime1">Initial value of the Regime1 property.</param>
 public static Regime CreateRegime(global::System.Guid id, global::System.String regime1)
 {
     Regime regime = new Regime();
     regime.ID = id;
     regime.Regime1 = regime1;
     return regime;
 }
Пример #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Regimes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToRegimes(Regime regime)
 {
     base.AddObject("Regimes", regime);
 }