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

            if (ModelState.IsValid)
            {

                Exhibit exhibit = db.Exhibits.Where(e => e.ID == timelineexhibit.ExhibitID).FirstOrDefault();
                Timeline timeline = db.Timelines.Where(t => t.ID == timelineexhibit.TimelineID).FirstOrDefault();

                if (isValid(timeline, exhibit))
                {
                    timelineexhibit.TimelineExhibitID = Guid.NewGuid();
                    timelineexhibit.CreatedBy = Guid.Parse(Session["userid"].ToString());
                    timelineexhibit.CreatedOn = DateTime.Now;
                    db.TimelineExhibits.AddObject(timelineexhibit);
                    db.SaveChanges();
                    return RedirectToAction("Index");
                }
            }

            ViewBag.ExhibitID = new SelectList(db.Exhibits.Where(r => r.IsDeleted == null || r.IsDeleted == false).OrderByDescending(e => e.CreatedOn), "ID", "Title", timelineexhibit.ExhibitID);
            ViewBag.TimelineID = new SelectList(db.Timelines.Where(r => r.IsDeleted == null || r.IsDeleted == false).OrderBy(t => t.Title), "ID", "Title", timelineexhibit.TimelineID);
            ViewBag.CreatedBy = new SelectList(db.Users, "ID", "UserName", timelineexhibit.CreatedBy);
            ViewBag.ModifiedBy = new SelectList(db.Users, "ID", "UserName", timelineexhibit.ModifiedBy);
            return View(timelineexhibit);
        }
Пример #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the TimelineExhibits EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTimelineExhibits(TimelineExhibit timelineExhibit)
 {
     base.AddObject("TimelineExhibits", timelineExhibit);
 }
Пример #3
0
 /// <summary>
 /// Create a new TimelineExhibit object.
 /// </summary>
 /// <param name="timelineExhibitID">Initial value of the TimelineExhibitID property.</param>
 /// <param name="timelineID">Initial value of the TimelineID property.</param>
 /// <param name="exhibitID">Initial value of the ExhibitID property.</param>
 public static TimelineExhibit CreateTimelineExhibit(global::System.Guid timelineExhibitID, global::System.Guid timelineID, global::System.Guid exhibitID)
 {
     TimelineExhibit timelineExhibit = new TimelineExhibit();
     timelineExhibit.TimelineExhibitID = timelineExhibitID;
     timelineExhibit.TimelineID = timelineID;
     timelineExhibit.ExhibitID = exhibitID;
     return timelineExhibit;
 }