コード例 #1
0
        public int Insert(Account account)
        {
            db.Accounts.Add(account);
            db.SaveChanges();

            return(account.id);
        }
コード例 #2
0
        public async Task <ActionResult> Create([Bind(Include = "id,username,password,groupid,name,gender,birthday,address,phone,email,status")] Account account)
        {
            if (ModelState.IsValid)
            {
                var encryptedMd5Pas = Encryptor.MD5Hash(account.password);
                account.password = encryptedMd5Pas;
                db.Accounts.Add(account);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.groupid = new SelectList(db.AccountGroups, "id", "name", account.groupid);
            return(View(account));
        }
コード例 #3
0
 public bool Insert(BillDetail detail)
 {
     try
     {
         db.BillDetails.Add(detail);
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #4
0
 public int Insert(Bill bill)
 {
     db.Bills.Add(bill);
     db.SaveChanges();
     return(bill.id);
 }