Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            //List<int> lista = new List<int>();
            //CreateCarCmd carCmd = new CreateCarCmd();
            //carCmd.Execute();

            //CreatePartCmd cmd = new CreatePartCmd();
            //cmd.Execute(new BL.Part.DTO.PartDTO() { Name = "wahacz"});
            var                      carGarageContext = new CarHistoryContext();
            GetAllCarQuery           query            = new GetAllCarQuery(carGarageContext);
            List <BL.Car.DTO.CarDTO> cars             = query.Execute();
            var                      index            = 0;

            Console.WriteLine(cars.Count.ToString());
            foreach (var car in cars)
            {
                Console.WriteLine(car.Name + "index= " + index);
                if (index == 2)
                {
                    continue;
                }
                index++;
            }
            Console.ReadKey();
        }
Ejemplo n.º 2
0
        public void Execute(PartDTO partDto)
        {
            using (_context = new CarHistoryContext())
            {
                //_context.Database.CreateIfNotExists();
                DB.Domain.Part part = new DB.Domain.Part();
                part.Name = partDto.Name;


                _context.Parts.Add(part);
                _context.SaveChanges();
            }
        }