public ActionResult Create(ExhibitReferenceEntity exhibitreferenceentity)
        {
            if (!Authorization.GetAccess(table, HttpContext.User.Identity.Name, write))
                return RedirectToAction("Index", "Home");

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

            ViewBag.ExhibitID = new SelectList(db.Exhibits, "ID", "Title", exhibitreferenceentity.ExhibitID);
            ViewBag.ReferenceID = new SelectList(db.References, "ID", "Authors", exhibitreferenceentity.ReferenceID);
            ViewBag.CreatedBy = new SelectList(db.Users, "ID", "UserName", exhibitreferenceentity.CreatedBy);
            ViewBag.ModifiedBy = new SelectList(db.Users, "ID", "UserName", exhibitreferenceentity.ModifiedBy);
            return View(exhibitreferenceentity);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the ExhibitReferenceEntities EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToExhibitReferenceEntities(ExhibitReferenceEntity exhibitReferenceEntity)
 {
     base.AddObject("ExhibitReferenceEntities", exhibitReferenceEntity);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Create a new ExhibitReferenceEntity object.
 /// </summary>
 /// <param name="exhibitReferenceID">Initial value of the ExhibitReferenceID property.</param>
 /// <param name="exhibitID">Initial value of the ExhibitID property.</param>
 /// <param name="referenceID">Initial value of the ReferenceID property.</param>
 public static ExhibitReferenceEntity CreateExhibitReferenceEntity(global::System.Guid exhibitReferenceID, global::System.Guid exhibitID, global::System.Guid referenceID)
 {
     ExhibitReferenceEntity exhibitReferenceEntity = new ExhibitReferenceEntity();
     exhibitReferenceEntity.ExhibitReferenceID = exhibitReferenceID;
     exhibitReferenceEntity.ExhibitID = exhibitID;
     exhibitReferenceEntity.ReferenceID = referenceID;
     return exhibitReferenceEntity;
 }