Example #1
0
        public ActionResult Edit(MediaSet newSet)
        {
            string[] includeProps = new string[] { "Name", "StartDate", "EndDate", "Message" };
            MediaSet set = null;
            try {
                set = Context.MediaSets.Single(s => s.MediaSetId == newSet.MediaSetId);
                UpdateModel(set, includeProps);
                Context.SaveChanges();
                TempData["message"] = new InfoMessage("Fotoset aangepast.", InfoMessage.InfoType.Notice);
            }
            catch (Exception e) {
                Elmah.ErrorSignal.FromCurrentContext().Raise(e);
                TempData["message"] = new InfoMessage("Fout bij het bewerken van fotoset.", InfoMessage.InfoType.Error);
            }

            return RedirectToAction("Edit", new { id = set.MediaSetId });
        }
Example #2
0
        private void FixupMediaSet(MediaSet previousValue)
        {
            if (previousValue != null && previousValue.MediaGroups.Contains(this))
            {
                previousValue.MediaGroups.Remove(this);
            }

            if (MediaSet != null)
            {
                if (!MediaSet.MediaGroups.Contains(this))
                {
                    MediaSet.MediaGroups.Add(this);
                }
                if (MediaSetId != MediaSet.MediaSetId)
                {
                    MediaSetId = MediaSet.MediaSetId;
                }
            }
        }