Пример #1
0
        private static Dto.Category GetById(int id)
        {
            //jalamos  base de datos
            var entities = new POSEntities();
            var categoryTemp = entities.Category.Find(id);

            //traducimos a dto bus
            var category = new Category();
            category.Id = categoryTemp.id;
            category.Name = categoryTemp.name;
            category.Description = categoryTemp.description;

            //retornamos
            return category;
        }
Пример #2
0
        private static List<Dto.Category> GetByAll()
        {
            //jalamos  base de datos
            var entities = new POSEntities();
            var categoryTemp = entities.Category;

            //creamos lista vacia de dto
            var listofCategory = new List<Dto.Category>();

            //recorremos la lista de employees temporal

            foreach (var item in categoryTemp)
            {

                //traducimos a dto employees
                var category = new Category();
                category.Id = item.id;
                category.Name = item.name;
                category.Description = item.description;

                listofCategory.Add(category);
            }
            return listofCategory;
        }