public ActionResult Create([Bind(Include = "u_id,u_name,u_gender,u_email,u_phone,u_address,u_status,ac_id")] User user) { if (ModelState.IsValid) { db.User.Add(user); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ac_id = new SelectList(db.Account, "ac_id", "ac_userName", user.ac_id); return(View(user)); }
/// <summary> /// insert comment detail to db /// </summary> /// <param name="cmd"></param> /// <returns></returns> public bool InsertCommentDetail(CommentDetail cmd) { try { db.CommentDetail.Add(cmd); db.SaveChanges(); return(true); } catch { return(false); } }
/// <summary> /// add comment to db /// </summary> /// <param name="cm"></param> /// <returns></returns> public bool InsertComment(Comment cm) { try { db.Comment.Add(cm); db.SaveChanges(); return(true); } catch { return(false); } }
/// <summary> /// insert bill detail /// </summary> /// <param name="billdetai"></param> /// <returns></returns> public bool InsertBillDetail(BillDetail billdetai) { try { db.BillDetail.Add(billdetai); db.SaveChanges(); return(true); } catch { return(false); } }
public void InsertUser(string name, string gender, string email, string phone, string address, int ac_id) { var user = new User(); user.u_name = name; user.u_gender = gender; user.u_email = email; user.u_phone = phone; user.u_address = address; user.u_status = "Active"; user.ac_id = ac_id; using (var db = new PetStoreOnlineDbContext()) { db.User.Add(user); db.SaveChanges(); } }
/// <summary> /// Insert Account /// </summary> /// <param name="ac"></param> /// <returns></returns> public int InsertAccount(Account ac) { db.Account.Add(ac); db.SaveChanges(); return(ac.ac_id); }
/// <summary> /// insert bill /// </summary> /// <param name="bill"></param> /// <returns></returns> public int InsertBill(Bill bill) { db.Bill.Add(bill); db.SaveChanges(); return(bill.b_id); }