示例#1
0
        private static void GetAUser()
        {
            Console.Write("Please enter the User ID: ");
            int      id = int.Parse(Console.ReadLine());
            IUserDTO retrievedUserDTO = FactoryBase.CreateDTOInstance <IUserDTO>();

            retrievedUserDTO = userBDC.GetAUser(id);
            PrintJSONifyUserDTO(retrievedUserDTO);
        }
示例#2
0
        public IUserDTO GetAUser(int id)
        {
            IUserDTO userDTO = FactoryBase.CreateDTOInstance <IUserDTO>();

            using (UserStoryEntities context = new UserStoryEntities())
            {
                User user = context.Users.Find(id);
                EntityConverter.FillDTOFromEntity(userDTO, user);
            }
            return(userDTO);
        }
示例#3
0
        public List <IUserDTO> GetAllUsers()
        {
            List <IUserDTO>   usersDTO = new List <IUserDTO>();
            UserStoryEntities context  = new UserStoryEntities();

            using (context)
            {
                foreach (User user in context.Users)
                {
                    IUserDTO userDTO = FactoryBase.CreateDTOInstance <IUserDTO>();
                    EntityConverter.FillDTOFromEntity(userDTO, user);
                    usersDTO.Add(userDTO);
                }
            }
            return(usersDTO);
        }