public List <PuffEdit> GetPuffList() { List <PuffEdit> puffEditList = new List <PuffEdit>(); ProgramsController pc = new ProgramsController(); var prog = pc.SendList(); var puff = db.Puff.Include(p => p.Program); foreach (var l in puff) { foreach (var p in prog) { PuffEdit o = new PuffEdit(); if (l.Progid == p.Id) { o.Pid = l.Pid; o.Progid = p.Id; o.ProgramName = p.ProgramName; o.Time = p.Time; o.Date = p.Date; o.ChannelId = p.ChannelId.Value; o.Category = p.Category; o.Length = p.Length; o.Info = p.Info; puffEditList.Add(o); } } } return(puffEditList); }