Пример #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, NewDataBaseContext context)
        {
            context.Database.EnsureCreated();
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();

            // Enable middleware to serve generated Swagger as a JSON endpoint.
            app.UseSwagger();

            // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
            // specifying the Swagger JSON endpoint.
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Medical App API");
            });

            app.UseRouting();

            app.UseCors("AllowFrontEnd");

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Пример #2
0
 /// <summary>
 /// this function display Details of an order
 /// </summary>
 public void DisplayOrderDetails(int orderId)
 {
     //Trys to find the order id matching the parameter passed in
     if (repository.GetAll().Any(o => o.OrderId == orderId))
     {
         //loads that order into variable
         var context = new NewDataBaseContext(GenericRepository <OrderHistory> .Options);
         var order   = context.OrderHistory
                       .Include(o => o.Order)
                       .ThenInclude(or => or.Product)
                       .First(o => o.OrderId == orderId);
         //Displays the details of that order calling it from the order variablle
         Console.WriteLine($"OrderID: {order.OrderId} Total Cost: ${order.TotalCost}\n" +
                           $"CustomerID: {order.CustomerId} Date-Time: {order.Date} {order.Time} LocationID: {order.LocationId}\n");
         //loops through all the items in cart
         foreach (var a in order.Order)
         {
             Console.WriteLine($"Product: {a.Product.ProductName}\nPrice: ${a.Product.Price}\nQty: {a.Amount}\n");
         }
         context.Dispose();
     }
     else
     {
         Console.WriteLine($"\nSorry, Order not found.\n");
     }
 }
Пример #3
0
 public UserRepository(NewDataBaseContext context)
 {
     _context = context;
 }
 public CoursesController(NewDataBaseContext context)
 {
     _context = context;
 }
        /// <summary>
        /// Creates order repo for data manipulation of table
        /// </summary>
        ///


        public OrderRepository(NewDataBaseContext dbContext)
        {
            _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
        }
 public StudentsController(NewDataBaseContext context)
 {
     _context = context;
 }
Пример #7
0
 public ReviewRepository(NewDataBaseContext context)
 {
     _context = context;
 }
 /// <summary>
 /// constuctor intializing the context and table with the context generated from the constructor taking in options
 /// </summary>
 /// <param name="_context"></param>
 public GenericRepository(NewDataBaseContext _context)
 {
     this._context = _context;
     table         = _context.Set <T>();
 }
 /// <summary>
 /// generic repo constructor, used for intializing the repositories with the context and table using options
 /// </summary>
 public GenericRepository()
 {
     this._context = new NewDataBaseContext(Options);
     table         = _context.Set <T>();
 }
 public GroupsController(NewDataBaseContext context)
 {
     _context = context;
 }
Пример #11
0
 public BookingRepository(NewDataBaseContext context)
 {
     _context = context;
 }