Exemplo n.º 1
0
        public List<ApplicationTO> GetAllApplications()
        {
            List<ApplicationTO> applicationTOs = new List<ApplicationTO>();

            using(var db = new WamAppEntities1())
            {
                var applications = from a in db.Applications select a;
                foreach(Application app in applications){
                    ApplicationTO appTO = new ApplicationTO { id = app.Id, name = app.name };
                    applicationTOs.Add(appTO);
                }
            }

            return applicationTOs;
        }
Exemplo n.º 2
0
        public List<ApplicationTO> GetApplicationsForUsername(string username)
        {
            List<ApplicationTO> applicationTOs = new List<ApplicationTO>();

            using (var db = new WamAppEntities1())
            {
                var applications = from a in db.Applications
                                   join d in db.Developers
                                   on a.userId equals d.Id
                                   where d.username == username
                                   select a;
                foreach (Application app in applications)
                {
                    ApplicationTO appTO = new ApplicationTO { id = app.Id, name = app.name };
                    applicationTOs.Add(appTO);
                }
            }

            return applicationTOs;
        }