Exemplo n.º 1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new MoneyContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <MoneyContext> >()))
            {
                if (context.MCategory.Any())
                {
                    return;
                }

                var listIncome = new List <string>
                {
                    "เงินเดือน",
                    "ดอกเบี้ย",
                    "ของขวัญ",
                    "เงินรางวัล",
                    "อื่นๆ"
                };

                var listOutcome = new List <string>
                {
                    "การลงทุน",
                    "การศึกษา",
                    "ที่จอดรถ",
                    "บำรุงรักษารถ",
                    "บริจาค",
                    "ครอบครัว",
                    "ปรับปรุงบ้าน",
                    "ค่าธรรมเนียม",
                    "ช้อปปิ้ง",
                    "บันเทิง",
                    "บิล & สาธารณูปโภค",
                    "ประกันภัย",
                    "สุขภาพ & กีฬา",
                    "อาหาร",
                    "เพื่อน",
                    "อื่นๆ",
                };

                foreach (string strIncomeName in listIncome)
                {
                    context.MCategory.Add(new MCategory
                    {
                        Name           = strIncomeName,
                        CashflowTypeId = CashflowTypeId_Income
                    });
                }

                foreach (string strOutcomeName in listOutcome)
                {
                    context.MCategory.Add(new MCategory
                    {
                        Name           = strOutcomeName,
                        CashflowTypeId = CashflowTypeId_Outcome
                    });
                }
                context.SaveChanges();
            }
        }
Exemplo n.º 2
0
        public JsonResult TransferToChinese(long number)
        {
            MoneyContext    context = new MoneyContext(number);
            MoneyController uco     = new MoneyController();

            uco.TransferToChinese(ref context);
            return(Json(context.ToChinese(), JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
 public AccountService(MoneyContext moneyContext, IEntityPersister entityPersister)
 {
     this.moneyContext    = moneyContext;
     this.entityPersister = entityPersister;
 }
Exemplo n.º 4
0
 public BankAccountsController(MoneyContext context)
 {
     _context = context;
 }