public CrearTurneroResponse Procesar(CrearTurneroRequest req)
        {
            var direccion = new Direccion()
            {
                Ciudad = req.Ciudad,
                Calle  = req.Calle,
                Numero = req.Numero
            };

            Turnero turnero;

            turnero = new Turnero(
                req.IdPropietario,
                req.Concepto,
                req.Ubicacion,
                direccion,
                req.CantidadMaxima == 0 ? int.MaxValue : req.CantidadMaxima,
                req.Files
                );

            _repository.Turneros.Add(turnero);
            _repository.SaveChanges();

            var response = new CrearTurneroResponse();

            return(response);
        }
 public ListarTurnerosDTO(Turnero turnero)
 {
     Id               = turnero.Id;
     IdPropietario    = turnero.IdPropietario;
     Concepto         = turnero.Concepto;
     Ciudad           = turnero.Direccion.Ciudad;
     Calle            = turnero.Direccion.Calle;
     Numero           = turnero.Direccion.Numero;
     CantidadEnEspera = turnero.CantidadEnEspera();
 }
        private static List <String> ToListOfPath(Turnero t)
        {
            List <string> ret = new List <string>();

            foreach (var f in t.Files)
            {
                ret.Add(f.Path);
            }
            return(ret);
        }
        static ListarTurneroMapaDTO TurneroToListarTurneroDTO(Turnero turnero)
        {
            var paths = ToListOfPath(turnero);

            return(new ListarTurneroMapaDTO
            {
                Id = turnero.Id,
                Concepto = turnero.Concepto,
                Ciudad = turnero.Direccion.Ciudad,
                Calle = turnero.Direccion.Calle,
                Numero = turnero.Direccion.Numero,
                Ubicacion = turnero.Ubicacion,
                CantidadMaxima = turnero.CantidadMaxima,
                CantidadEnEspera = turnero.CantidadEnEspera(),
                Files = paths
            });
        }
Пример #5
0
        public static void Load(ApplicationDbContext context)
        {
            FilePath p1 = new FilePath(0, "Carrefour.png");
            FilePath p2 = new FilePath(0, "Coto.png");
            FilePath p3 = new FilePath(0, "Disco.jpg");
            FilePath p4 = new FilePath(0, "Dia.jpg");

            var turneros = new Turnero[] { new Turnero(
                                               idPropietario: "seedUser",
                                               concepto: "Carrefour",
                                               ubicacion: new Dominio.LatLon(lat: -34.61066273180164, lon: -58.41436768925822),
                                               direccion: new Dominio.Direccion {
                    Calle = "Uriarte", Ciudad = "CABA", Numero = 812
                },
                                               cantidaMaxima: 100,
                                               new List <FilePath> {
                    p1
                }
                                               ),


                                           //new Turnero(
                                           //    idPropietario: "seedUser",
                                           //  concepto: "Walmart",
                                           //  ubicacion: new Dominio.LatLon ( lat: -34.611510422952044, lon: -58.454536451464705 ),
                                           //  direccion: new Dominio.Direccion { Calle = "CaleRoja", Ciudad = "CABA", Numero = 756 },
                                           //  cantidaMaxima: 100,
                                           //  new List<FilePath> { p1 }
                                           //  ),

                                           //new Turnero(
                                           //    idPropietario: "seedUser",
                                           //  concepto: "Disco",
                                           //  ubicacion: new Dominio.LatLon ( lat: -34.611510422952064, lon: -58.454536451464705 ),
                                           //  direccion: new Dominio.Direccion { Calle = "CalleX", Ciudad = "CABA", Numero = 256 },
                                           //  cantidaMaxima: 2,
                                           //  new List<FilePath> { p3 }
                                           //  ),

                                           //new Turnero(
                                           //    idPropietario: "2",
                                           //  concepto: "Carpinteria Maderas",
                                           //  ubicacion: new Dominio.LatLon (lat:-34.604446065572695, lon :-58.40338136113314 ),
                                           //  direccion: new Dominio.Direccion { Calle = "Arboles", Ciudad = "CABA", Numero = 1563 },
                                           //  cantidaMaxima: int.MaxValue,
                                           //  new List<FilePath>()
                                           // ),

                                           new Turnero(
                                               idPropietario: "seedUser",
                                               concepto: "Disco",
                                               ubicacion: new Dominio.LatLon(lat: -34.611510422952264, lon: -58.454536451464705),
                                               direccion: new Dominio.Direccion {
                    Calle = "La Rioja", Ciudad = "CABA", Numero = 210
                },
                                               cantidaMaxima: 2,
                                               new List <FilePath> {
                    p3
                }
                                               ) };

            context.Turneros.AddRange(turneros);
            context.SaveChanges();

            turneros[0].ExpedirTurno("*****@*****.**");
            turneros[0].ExpedirTurno("*****@*****.**");
            turneros[0].ExpedirTurno("*****@*****.**");
            turneros[0].ExpedirTurno("*****@*****.**");
            turneros[0].ExpedirTurno("*****@*****.**");
            turneros[1].ExpedirTurno("*****@*****.**");
            //turneros[2].ExpedirTurno("*****@*****.**");
            //turneros[2].ExpedirTurno("*****@*****.**");

            context.SaveChanges();
        }
 static ListarTurnerosDTO TurneroToListarTurneroDTO(Turnero turnero)
 {
     return(new ListarTurnerosDTO(turnero));
 }
Пример #7
0
 public void EliminarTurnero(Turnero turnero)
 {
     _turneros.Remove(turnero);
 }
Пример #8
0
 public void AgregarTurnero(Turnero turnero)
 {
     _turneros.Add(turnero);
 }