コード例 #1
0
        public void Create(Guid Id, int Category, DateTime Date, int Amount, String Remark)
        {
            AccountBook Data = new AccountBook
            {
                Id         = Id,
                Categoryyy = Category,
                Dateee     = Date,
                Amounttt   = Amount,
                Remarkkk   = Remark
            };

            db.AccountBook.Add(Data);
            db.SaveChanges();
        }
コード例 #2
0
        public void AddAccountBook(AccountBook entity)
        {
            SkillTreeHomeworkEntities1 _dbcontext = new SkillTreeHomeworkEntities1();

            _dbcontext.AccountBook.Add(entity);
            _dbcontext.SaveChanges();
        }
コード例 #3
0
ファイル: HomeController.cs プロジェクト: yachun0728/Homework
 public ActionResult Index([Bind(Include = "Category, Money, Date, Description")] MoneyList moneyList)
 {
     if (ModelState.IsValid)
     {
         var skillTreeHomeworkEntities = new SkillTreeHomeworkEntities1();
         skillTreeHomeworkEntities.AccountBooks.Add(new AccountBook()
         {
             Id         = Guid.NewGuid(),
             Categoryyy = int.Parse(moneyList.Category),
             Amounttt   = (int)moneyList.Money,
             Dateee     = moneyList.Date,
             Remarkkk   = moneyList.Description
         });
         skillTreeHomeworkEntities.SaveChanges();
     }
     return(RedirectToAction("Index"));
 }