예제 #1
0
        public DTOContainer Export(string tempExportDirectory, bool exportAll)
        {
            IEnumerable <Guid> zustandsAbschnittIDs = null;
            IEnumerable <ZustandsabschnittGISDTO> zustandsAbschnitte = null;

            if (exportAll)
            {
                zustandsAbschnitte   = dtoService.GetAll <ZustandsabschnittGISDTO>();
                zustandsAbschnittIDs = zustandsAbschnitte.Select(z => z.Id);
            }
            else
            {
                var strassenabschnitte = dtoService.GetAll <StrassenabschnittGISDTO>().Where(s => s.InspektionsRouteId == formService.GetActiveInspektionsRoute()).Select(s => s.Id);

                zustandsAbschnitte   = dtoService.GetAll <ZustandsabschnittGISDTO>().Where(z => strassenabschnitte.Contains(z.StrassenabschnittGIS));
                zustandsAbschnittIDs = zustandsAbschnitte.Select(z => z.Id);
            }


            DTOContainer dtocontainer = new DTOContainer();

            dtocontainer.DataTransferObjects = dtocontainer.DataTransferObjects.Concat(zustandsAbschnitte).ToList();

            foreach (var schadendetail in dtoService.GetAll <SchadendetailDTO>().Where(sd => zustandsAbschnittIDs.Contains(sd.ZustandsabschnittId)))
            {
                dtocontainer.DataTransferObjects.Add(schadendetail);
            }
            foreach (var schadengrouppe in dtoService.GetAll <SchadengruppeDTO>().Where(sg => zustandsAbschnittIDs.Contains(sg.ZustandsabschnittId)))
            {
                dtocontainer.DataTransferObjects.Add(schadengrouppe);
            }
            dtoService.saveFile(dtocontainer, Path.Combine(tempExportDirectory, FileNameConstants.DTOContainerFileName));

            return(dtocontainer);
        }
예제 #2
0
        //public ProductController()
        //{
        //	this.cartService = new CartVMService(new CartRep(new ShopContext()));
        //	productRep = new ProductVMService(new ProductRep(new ShopContext()));
        //	photoRep = new PhotoVMService(new PhotoRep(new ShopContext()));
        //}

        // GET: Product
        public ActionResult Index()
        {
            IEnumerable <ProductVM> model = productRep.GetAll();

            return(View(model));
        }