Example #1
0
        public static ShoppingCart GetCart(IContosoWebContext db, String cartID)
        {
            var cart = new ShoppingCart(db);

            cart.ShoppingCartId = cartID;
            return(cart);
        }
Example #2
0
        public static LiveStat[] RetrieveLatestLiveStats(IContosoWebContext dbContext, int matchId)
        {
            Match match = dbContext.Matches
                          .Include(x => x.HomeTeamStats)
                          .Include(x => x.AwayTeamStats)
                          .FirstOrDefault(m => m.MatchId == matchId);

            if (match == null)
            {
                return(null);
            }

            return(new[] {
                new LiveStat("Goals", match.HomeTeamStats.Goals, match.AwayTeamStats.Goals),
                new LiveStat("Shots", match.HomeTeamStats.Shots, match.AwayTeamStats.Shots),
                new LiveStat("Passes", match.HomeTeamStats.Passes, match.AwayTeamStats.Passes),
                new LiveStat("Fouls Lost", match.HomeTeamStats.FoulsLost, match.AwayTeamStats.FoulsLost),
                new LiveStat("Fouls Won", match.HomeTeamStats.FoulsWon, match.AwayTeamStats.FoulsWon),
                new LiveStat("Offside", match.HomeTeamStats.Offside, match.AwayTeamStats.Offside),
                new LiveStat("Corners", match.HomeTeamStats.Corners, match.AwayTeamStats.Corners)
            });
        }
 public ShoppingCartController(IContosoWebContext context, ITelemetryProvider telemetryProvider)
 {
     db = context;
     telemetry = telemetryProvider;
 }
 public ProductsController(IContosoWebContext context)
 {
     _context = context;
 }
 public StringContainsProductSearch(IContosoWebContext context)
 {
     _context = context;
 }
 public HomeController(IContosoWebContext context)
 {
     _db = context;
 }
Example #7
0
 public StoreController(IContosoWebContext context)
 {
     db = context;
 }
Example #8
0
 public CustomerController(IContosoWebContext context)
 {
     _context = context;
 }
 public HomeController(IContosoWebContext context)
 {
     _db = context;
 }
Example #10
0
 public RecommendationsController(IContosoWebContext context, IRecommendationEngine recommendationEngine)
 {
     db             = context;
     recommendation = recommendationEngine;
 }
 public CustomerController(IContosoWebContext context)
 {
     _context = context;
 }
 public static ShoppingCart GetCart(IContosoWebContext db, String cartID)
 {
     var cart = new ShoppingCart(db);
     cart.ShoppingCartId = cartID;
     return cart;
 }
 public ShoppingCart(IContosoWebContext db)
 {
     _db = db;
 }
 public StoreManagerController(IContosoWebContext context)
 {
     db = context;
 }
 public CheckoutController(IContosoWebContext context)
 {
     db = context;
 }
 public ShoppingCartController(IContosoWebContext context, ITelemetryProvider telemetryProvider)
 {
     db        = context;
     telemetry = telemetryProvider;
 }
 public RaincheckQuery(IContosoWebContext context)
 {
     this.context = context;
 }
Example #18
0
 public RaincheckQuery(IContosoWebContext context)
 {
     this.context = context;
 }
Example #19
0
 public OrdersQuery(IContosoWebContext context)
 {
     db = context;
 }
        public static UserManager<ApplicationUser> CreateUserManager(IDataProtectionProvider dataProtectionProvider, IContosoWebContext context)
        {
            var manager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>((DbContext)context));
            // Configure validation logic for usernames
            manager.UserValidator = new UserValidator<ApplicationUser>(manager)
            {
                AllowOnlyAlphanumericUserNames = false,
                RequireUniqueEmail = true
            };

            // Configure validation logic for passwords
            manager.PasswordValidator = new PasswordValidator
            {
                RequiredLength = 6,
                RequireNonLetterOrDigit = true,
                RequireDigit = true,
                RequireLowercase = true,
                RequireUppercase = true,
            };

            // Configure user lockout defaults
            manager.UserLockoutEnabledByDefault = true;
            manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromMinutes(5);
            manager.MaxFailedAccessAttemptsBeforeLockout = 5;

            // Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user
            // You can write your own provider and plug it in here.
            manager.RegisterTwoFactorProvider("Phone Code", new PhoneNumberTokenProvider<ApplicationUser>
            {
                MessageFormat = "Your security code is {0}"
            });
            manager.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider<ApplicationUser>
            {
                Subject = "Security Code",
                BodyFormat = "Your security code is {0}"
            });
            manager.EmailService = new EmailService();
            manager.SmsService = new SmsService();

            if (dataProtectionProvider != null)
            {
                manager.UserTokenProvider = new DataProtectorTokenProvider<ApplicationUser>(dataProtectionProvider.Create("ASP.NET Identity"));
            }

            return manager;
        }
Example #21
0
 public ShoppingCart(IContosoWebContext db)
 {
     _db = db;
 }
Example #22
0
 public ProductsController(IContosoWebContext context)
 {
     _context = context;
 }
 public OrdersQuery(IContosoWebContext context)
 {
     db = context;
 }
 public StringContainsProductSearch(IContosoWebContext context)
 {
     _context = context;
 }
Example #25
0
 public CheckoutController(IContosoWebContext context)
 {
     db = context;
 }
Example #26
0
        public static UserManager <ApplicationUser> CreateUserManager(IDataProtectionProvider dataProtectionProvider, IContosoWebContext context)
        {
            var manager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>((DbContext)context));

            // Configure validation logic for usernames
            manager.UserValidator = new UserValidator <ApplicationUser>(manager)
            {
                AllowOnlyAlphanumericUserNames = false,
                RequireUniqueEmail             = true
            };

            // Configure validation logic for passwords
            manager.PasswordValidator = new PasswordValidator
            {
                RequiredLength          = 6,
                RequireNonLetterOrDigit = true,
                RequireDigit            = true,
                RequireLowercase        = true,
                RequireUppercase        = true,
            };

            // Configure user lockout defaults
            manager.UserLockoutEnabledByDefault          = true;
            manager.DefaultAccountLockoutTimeSpan        = TimeSpan.FromMinutes(5);
            manager.MaxFailedAccessAttemptsBeforeLockout = 5;

            // Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user
            // You can write your own provider and plug it in here.
            manager.RegisterTwoFactorProvider("Phone Code", new PhoneNumberTokenProvider <ApplicationUser>
            {
                MessageFormat = "Your security code is {0}"
            });
            manager.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider <ApplicationUser>
            {
                Subject    = "Security Code",
                BodyFormat = "Your security code is {0}"
            });
            manager.EmailService = new EmailService();
            manager.SmsService   = new SmsService();

            if (dataProtectionProvider != null)
            {
                manager.UserTokenProvider = new DataProtectorTokenProvider <ApplicationUser>(dataProtectionProvider.Create("ASP.NET Identity"));
            }

            return(manager);
        }
 public RecommendationsController(IContosoWebContext context, IRecommendationEngine recommendationEngine)
 {
     db = context;
     recommendation = recommendationEngine;
 }