public static ShoppingCart GetCart(IContosoWebContext db, String cartID) { var cart = new ShoppingCart(db); cart.ShoppingCartId = cartID; return(cart); }
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; }
public StoreController(IContosoWebContext context) { db = context; }
public CustomerController(IContosoWebContext context) { _context = context; }
public RecommendationsController(IContosoWebContext context, IRecommendationEngine recommendationEngine) { db = context; recommendation = recommendationEngine; }
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 RaincheckQuery(IContosoWebContext context) { this.context = context; }
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; }
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); }