Exemplo n.º 1
0
        public ActionResult Create(string name, int mediaGroupedBy, int customerId)
        {
            var animation = new Animation() {
                Name = name,
                MediaGroupedBy = mediaGroupedBy,
                CustomerId = customerId
            };
            Context.Animations.AddObject(animation);
            Context.SaveChanges();

            return RedirectToAction("Index");
        }
Exemplo n.º 2
0
Arquivo: Log.cs Projeto: Grepsy/WebTV
        private void FixupAnimation(Animation previousValue)
        {
            if (previousValue != null && previousValue.Logs.Contains(this))
            {
                previousValue.Logs.Remove(this);
            }

            if (Animation != null)
            {
                if (!Animation.Logs.Contains(this))
                {
                    Animation.Logs.Add(this);
                }
                if (AnimationId != Animation.AnimationId)
                {
                    AnimationId = Animation.AnimationId;
                }
            }
        }
Exemplo n.º 3
0
 private object AnimationToJson(Animation animation)
 {
     string imageUrl = Url.Action("Show", "Media", null, Request.Url.Scheme, Request.Url.Host);
     var json = new {
         Name = animation.Name,
         MediaGroupedBy = animation.MediaGroupedBy,
         MediaSets = animation.MediaSets
             .Where(m => m.StartDate.HasValue && m.EndDate.HasValue)
             .Where(m => m.StartDate.Value < DateTime.Now && m.EndDate.Value > DateTime.Now)
             .Select(s => new {
                 Name = s.Name,
                 StartDate = s.StartDate,
                 EndDate = s.EndDate,
                 Message  = s.Message,
                 Media = animation.MediaGroupedBy == 1 ? s.Media.Select(m => m.ToJsonObject(imageUrl)) : null,
                 Groups = s.MediaGroups.Select(g => g.ToJsonObject(imageUrl))
         })
     };
     return json;
 }