Exemple #1
0
        public GovernateVM GetOne(int id)
        {
            var gov =
                (from g in db.Governates
                 where g.Id == id
                 select g).FirstOrDefault();

            GovernateVM govVm = new GovernateVM();

            if (gov != null)
            {
                govVm = ConvertClass.GovernateToVM(gov);
            }
            return(govVm);
        }
Exemple #2
0
        public IEnumerable <GovernateVM> Get()
        {
            var gov =
                (from g in db.Governates
                 select g).ToList();

            List <GovernateVM> govList = new List <Models.GovernateVM>();
            List <string>      city    = new List <string>();

            city.Add("no City");
            govList.Add(new GovernateVM {
                Id = 0, Name = "all  Governates", Cities = city
            });
            foreach (var item in gov)
            {
                govList.Add(ConvertClass.GovernateToVM(item));
            }
            return(govList);
        }