public ActionResult Create(Threshold threshold) { if (!Authorization.GetAccess(table, HttpContext.User.Identity.Name, write)) return RedirectToAction("Index", "Home"); if (ModelState.IsValid) { threshold.ID = Guid.NewGuid(); threshold.CreatedBy = Guid.Parse(Session["userid"].ToString()); threshold.CreatedOn = DateTime.Now; db.Thresholds.AddObject(threshold); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CreatedBy = new SelectList(db.Users, "ID", "UserName", threshold.CreatedBy); ViewBag.ModifiedBy = new SelectList(db.Users, "ID", "UserName", threshold.ModifiedBy); ViewBag.ThresholdTimeUnit = new SelectList(db.TimeUnits.Where(tu => tu.IsDeleted == null || tu.IsDeleted == false), "ID", "TimeUnit1"); ViewBag.BookmarkID = new SelectList(db.BookMarks.Where(tu => tu.IsDeleted == null || tu.IsDeleted == false), "ID", "Name"); return View(threshold); }
/// <summary> /// Create a new Threshold object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="threshold1">Initial value of the Threshold1 property.</param> public static Threshold CreateThreshold(global::System.Guid id, global::System.String threshold1) { Threshold threshold = new Threshold(); threshold.ID = id; threshold.Threshold1 = threshold1; return threshold; }
/// <summary> /// Deprecated Method for adding a new object to the Thresholds EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToThresholds(Threshold threshold) { base.AddObject("Thresholds", threshold); }