Пример #1
0
        public MediaGroup Copy()
        {
            var copy = new MediaGroup() {
                MediaSetId = this.MediaSetId,
            };

            foreach (var prop in this.Properties) {
                copy.Properties.Single(p => p.PropertyDescriptorId.Equals(prop.PropertyDescriptorId)).Value = prop.Value;
            }
            return copy;
        }
Пример #2
0
        public ActionResult New(int mediaSetId)
        {
            try {
                var group = new MediaGroup() {
                    MediaSetId = mediaSetId
                };
                Context.MediaGroups.AddObject(group);
                //group.PropertyWithName("Naam").Value = "Nieuwe groep";

                Context.SaveChanges();
                TempData["message"] = new InfoMessage("Nieuwe groep is aangemaakt.", InfoMessage.InfoType.Notice);
            }
            catch (Exception e) {
                Elmah.ErrorSignal.FromCurrentContext().Raise(e);
                TempData["message"] = new InfoMessage("Er is een fout opgetreden bij het maken van de group.", InfoMessage.InfoType.Error);
            }
            return Redirect(Request.UrlReferrer.ToString());
        }
Пример #3
0
        private void FixupMediaGroup(MediaGroup previousValue)
        {
            if (previousValue != null && previousValue.Properties.Contains(this))
            {
                previousValue.Properties.Remove(this);
            }

            if (MediaGroup != null)
            {
                if (!MediaGroup.Properties.Contains(this))
                {
                    MediaGroup.Properties.Add(this);
                }
                if (MediaGroupId != MediaGroup.MediaGroupId)
                {
                    MediaGroupId = MediaGroup.MediaGroupId;
                }
            }
            else if (!_settingFK)
            {
                MediaGroupId = null;
            }
        }