public void Setup() { Database.SetInitializer <ApplicationDbContext>(null); var config = new MapperConfiguration(cfg => { cfg.CreateMap <VintageDto, VintageViewModel>().ReverseMap(); }); mapper = config.CreateMapper(); db = new ApplicationDbContext(); manager = new ApplicationUserManager(new CustomUserStore(db), new DataProtectionProviderFactory(() => null)); var confRepo = new ConfRepo(db); gzTransactionRepo = new GzTransactionRepo(db, confRepo); userRepo = new UserRepo(db); custPortfolioRepo = new UserPortfolioRepo(db, confRepo, userRepo); invBalanceRepo = new InvBalanceRepo( db, new UserPortfolioSharesRepo(db), gzTransactionRepo, custPortfolioRepo, confRepo, userRepo ); db = CreateInvestmentsApiController(out investmentsApiController); }
public void Setup() { Database.SetInitializer <ApplicationDbContext>(null); db = new ApplicationDbContext(); devDbConnString = ConfigurationManager.ConnectionStrings["gzDevDb"].ConnectionString; var confRepo = new ConfRepo(db); gzTrx = new GzTransactionRepo(db, confRepo); var userRepo = new UserRepo(db); cpRepo = new UserPortfolioRepo(db, confRepo, userRepo); invBalRepo = new InvBalanceRepo(db, new UserPortfolioSharesRepo(db), gzTrx, cpRepo, confRepo, userRepo); }
private static void CreateUpdGzTransaction(ApplicationDbContext context, int custId) { var trxRepo = new GzTransactionRepo(context, new ConfRepo(context)); var now = DateTime.UtcNow; var startYearMonthStr = now.AddMonths(-6).ToStringYearMonth(); var endYearMonthStr = now.ToStringYearMonth(); // Loop through all the months activity while (startYearMonthStr.BeforeEq(endYearMonthStr)) { SetDbMonthlyPlayerLossTrx(startYearMonthStr, trxRepo, custId); // month ++ startYearMonthStr = DbExpressions.AddMonth(startYearMonthStr); } }
private static void SetDbMonthlyPlayerLossTrx(string trxYearMonthStr, GzTransactionRepo gzTrx, int custId) { var createdOnUtc = new DateTime( DbExpressions.GetYear(trxYearMonthStr), DbExpressions.GetMonth(trxYearMonthStr), 15, 19, 12, 59, 333, DateTimeKind.Utc); gzTrx.SaveDbPlayingLoss( custId, 1000, trxYearMonthStr, createdOnUtc, 3000, 3000, 1000, -2000, 3000); }