public ActionResult Create([Bind(Include = "BranchID,BranchName,rowguid")] Branch branch) { if (ModelState.IsValid) { db.Branches.Add(branch); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(branch)); }
public ActionResult Create([Bind(Include = "FullName,Birthday,Address,PID,PhoneNumber,Branch")] Staff staff) { if (ModelState.IsValid) { //default function //db.Staffs.Add(staff); db.sp_add_Staff(staff.FullName, staff.Birthday, staff.Address, staff.PID, staff.PhoneNumber, staff.Branch); db.SaveChanges(); return(RedirectToAction("Index_Edit")); } return(View(staff)); }
public ActionResult Create([Bind(Include = "Customer,StartDate,EndDate,Interest,Period,Balance,Branch")] Account account) { if (ModelState.IsValid) { // default function to add into database //db.Accounts.Add(account); db.sp_add_Account(account.Customer, account.StartDate, null, account.Interest, account.Period, account.Balance, account.Branch); db.SaveChanges(); return(RedirectToAction("Index_Edit")); } ViewBag.Branch = new SelectList(db.Branches, "BranchID", "BranchName", account.Branch); ViewBag.Customer = new SelectList(db.Customers, "CustomerID", "FullName", account.Customer); return(View(account)); }
public ActionResult Create([Bind(Include = "FullName,Birthday,Address,PhoneNumber,Branch,PID")] Customer customer) { if (ModelState.IsValid) { //default function //db.Customers.Add(customer); //use store procedure db.sp_add_Customer(customer.FullName, customer.Birthday, customer.Address, customer.PhoneNumber, customer.Branch, customer.PID); db.SaveChanges(); return(RedirectToAction("Index_Edit")); } ViewBag.Branch = new SelectList(db.Branches, "BranchID", "BranchName", customer.Branch); return(View(customer)); }