Ejemplo n.º 1
0
        public M.MediaOtherPerson[] Get(long idOtherPerson)
        {
            var SMOP  = BD.MediaOtherPersons;
            var query = from MOP in SMOP
                        where (MOP.IdOtherPerson.Equals(idOtherPerson))
                        select new { MOP.Id, MOP.FileName, MOP.DownloadLink, MOP.LoadDate };

            M.MediaOtherPerson[] arrayMediaOtherPerson = new M.MediaOtherPerson[query.Count()];

            int i = 0;

            foreach (var item in query)
            {
                M.MediaOtherPerson temp = new M.MediaOtherPerson
                {
                    Id           = item.Id,
                    FileName     = item.FileName,
                    DownloadLink = item.DownloadLink,
                    LoadDate     = item.LoadDate
                };
                arrayMediaOtherPerson[i] = temp;
                i++;
            }
            return(arrayMediaOtherPerson);
        }
Ejemplo n.º 2
0
        public long Post(M.MediaOtherPerson mediaOtherPerson)
        {
            O.MediaOtherPerson BDMediaOtherPerson = new O.MediaOtherPerson
            {
                FileName      = "",
                DownloadLink  = "",
                LoadDate      = System.DateTime.Now.ToString("g"),
                LoadHourZone  = System.TimeZoneInfo.Local.ToString(),
                IdOtherPerson = mediaOtherPerson.IdOtherPerson
            };

            BD.MediaOtherPersons.Add(BDMediaOtherPerson);
            BD.SaveChanges();

            return(BDMediaOtherPerson.Id);
        }