public int Insert(Account account) { db.Accounts.Add(account); db.SaveChanges(); return(account.id); }
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)); }
public bool Insert(BillDetail detail) { try { db.BillDetails.Add(detail); db.SaveChanges(); return(true); } catch { return(false); } }
public int Insert(Bill bill) { db.Bills.Add(bill); db.SaveChanges(); return(bill.id); }