Beispiel #1
0
        public async Task <ActionResult> DownloadSignIn([FromServices] BlobContext blobContext, string id, string blob)
        {
            string          blobName = $"{blob}.docx";
            DownloadPayload blobData = await blobContext.GetStreamAsync(blobName);

            return(File(blobData.Stream, blobData.ContentType, blobName));
        }
Beispiel #2
0
        public async Task <ActionResult> GetSignInUrl([FromServices] BlobContext blobContext, string id, string blob)
        {
            string blobName = $"{blob}.docx";
            string blobUrl  = await blobContext.GetSecureUrlAsync(blobName);

            return(Redirect(blobUrl));
        }
Beispiel #3
0
        public OrderControllerTest()
        {
            DbContextOptions <BlobContext> options;
            var builder = new DbContextOptionsBuilder <BlobContext>();

            builder.UseInMemoryDatabase("OCT");
            options      = builder.Options;
            _blobContext = new BlobContext(options);

            MapperConfiguration mockMapper = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile(new OrderProfile());
            });
            var mapper = mockMapper.CreateMapper();

            _mapper = mapper;

            SeedDatabase.SeedDatabaseWithDefaultData(_blobContext);

            _ordersController = new OrderController(_blobContext, null, mapper);
        }
Beispiel #4
0
 public CharacterAPIController(BlobContext context)
 {
     _context = context;
 }
Beispiel #5
0
        public async Task <IActionResult> SignIn([FromServices] EventsContext eventsContext, [FromServices] BlobContext blobContext, int id)
        {
            var eventItem = await eventsContext.Events.SingleOrDefaultAsync(e => e.Id == id);

            SignInSheetState signInSheetState = default(SignInSheetState);

            if (String.IsNullOrEmpty(eventItem.SignInDocumentUrl))
            {
                using (Stream stream = new MemoryStream())
                {
                    await blobContext.UploadBlobAsync($"{eventItem.EventKey}.docx", stream);
                }
                eventItem.SignInDocumentUrl = PROCESSING_URI;
                await eventsContext.SaveChangesAsync();

                signInSheetState = SignInSheetState.SignInDocumentProcessing;
            }
            else if (eventItem.SignInDocumentUrl == PROCESSING_URI)
            {
                signInSheetState = SignInSheetState.SignInDocumentProcessing;
            }
            else
            {
                signInSheetState = SignInSheetState.SignInDocumentAlreadyExists;
            }

            SignInSheetViewModel viewModel = new SignInSheetViewModel
            {
                Event            = eventItem,
                SignInSheetState = signInSheetState
            };

            return(View(viewModel));
        }
Beispiel #6
0
 public MainController(BlobContext context)
 {
     _context = context;
 }
Beispiel #7
0
 public StoreController(BlobContext context)
 {
     _context = context;
 }
Beispiel #8
0
 public ProductAPIController(BlobContext context)
 {
     _context = context;
 }
Beispiel #9
0
        public static void SeedDatabaseWithDefaultData(BlobContext context)
        {
            if (!seeded)
            {
                context.Address.AddRange(
                    new Address()
                {
                    Id     = 1,
                    Street = "Im Waldweg 3",
                    Zip    = "77974",
                    City   = "Meißenheim"
                },
                    new Address()
                {
                    Id     = 2,
                    Street = "Königsgasse 14",
                    Zip    = "77770",
                    City   = "Durbach"
                });

                context.Category.Add(
                    new Category()
                {
                    Id   = 1,
                    Name = "Reifen"
                });

                context.CategoryProduct.Add(
                    new CategoryProduct()
                {
                    CategoryId = 1,
                    ProductId  = 1
                });

                context.Customer.Add(
                    new Customer()
                {
                    Id        = 1,
                    Firstname = "Philipp",
                    Lastname  = "Heim",
                    CreatedAt = DateTime.Parse("2020-05-12 21:32:43"),
                    AddressId = 1
                });

                context.Location.AddRange(
                    new Location()
                {
                    Id        = 1,
                    Name      = "Filiale 1",
                    AddressId = 1
                },
                    new Location()
                {
                    Id        = 2,
                    Name      = "Filiale 2",
                    AddressId = 2
                });

                context.LocationProduct.Add(
                    new LocationProduct()
                {
                    LocationId = 1,
                    ProductId  = 1,
                    Quantity   = 8
                });

                context.Order.AddRange(
                    new Order()
                {
                    Id                = 1,
                    CreatedAt         = DateTime.Parse("2020-05-12 21:32:43"),
                    CustomerId        = 1,
                    OrderedCustomerId = 1,
                    StateId           = 2
                },
                    new Order()
                {
                    Id                = 2,
                    CreatedAt         = DateTime.Parse("2020-05-12 23:56:08"),
                    CustomerId        = 1,
                    OrderedCustomerId = 1,
                    StateId           = 1
                });

                context.OrderedAddress.Add(
                    new OrderedAddress()
                {
                    Id     = 1,
                    Street = "Im Waldweg 3",
                    Zip    = "77974",
                    City   = "Meißenheim"
                });

                context.OrderedCustomer.Add(
                    new OrderedCustomer()
                {
                    Id               = 1,
                    Firstname        = "Philipp",
                    Lastname         = "Heim",
                    OrderedAddressId = 1
                });

                context.OrderedProduct.Add(
                    new OrderedProduct()
                {
                    Id        = 1,
                    Name      = "Yokohama Sommerreifen",
                    Price     = 250,
                    Sku       = "110132751",
                    ProductId = 1
                });

                context.OrderedProductOrder.Add(
                    new OrderedProductOrder()
                {
                    OrderedProductId = 1,
                    OrderId          = 1,
                    Quantity         = 4
                });

                context.Product.Add(
                    new Product()
                {
                    Id        = 1,
                    Name      = "Yokohama Sommerreifen",
                    Price     = 250,
                    Sku       = "110132751",
                    CreatedAt = DateTime.Parse("2020-05-12 21:32:43")
                });

                context.ProductProperty.Add(
                    new ProductProperty()
                {
                    ProductId  = 1,
                    PropertyId = 1
                });

                context.Property.Add(
                    new Property()
                {
                    Id    = 1,
                    Name  = "Größe",
                    Value = "205/50 R17"
                });

                context.State.AddRange(
                    new State()
                {
                    Id    = 1,
                    Value = "Erstellt"
                },
                    new State()
                {
                    Id    = 2,
                    Value = "In Bearbeitung"
                },
                    new State()
                {
                    Id    = 3,
                    Value = "Versand"
                },
                    new State()
                {
                    Id    = 4,
                    Value = "Archiviert"
                });

                context.SaveChanges();
                seeded = true;
            }
        }
 public LocationController(BlobContext context, ILogger <LocationController> logger, IMapper mapper)
 {
     _context = context;
     _logger  = logger;
     _mapper  = mapper;
 }
Beispiel #11
0
 public UsersController(BlobContext context)
 {
     _context = context;
 }
Beispiel #12
0
 public FridgeAPIController(BlobContext context)
 {
     _context = context;
 }
 public FileDetailController(BlobContext context)
 {
     _context = context;
 }
 public CustomerController(BlobContext context, ILogger <CustomerController> logger, IMapper mapper)
 {
     _context = context;
     _logger  = logger;
     _mapper  = mapper;
 }
Beispiel #15
0
 public WelcomeController(BlobContext context)
 {
     _context = context;
 }
 public ProductController(BlobContext context, ILogger <ProductController> logger, IMapper mapper)
 {
     _context = context;
     _logger  = logger;
     _mapper  = mapper;
 }