// // GET: /SysSms/ public ActionResult SmsCustomer(int custID, int?page) { Database db = new Database(); CustomerDAO cDAO = new CustomerDAO(db); CustomerModel cModel = cDAO.FindById(custID); db.Close(); ViewBag.CUSTOMER = cModel; db = new Database(); MassageDAO newDAO = new MassageDAO(db); List <MassageModel> newModel = newDAO.FindByCustomerID(custID); db.Close(); var numPage = page ?? 1; var data = newModel.ToPagedList(numPage, 20); ViewBag.SMS = data; return(View()); }
public ActionResult SendSms(string sms, int custID, string tel) { // insert sms into database MassageModel model = new MassageModel(); model.CUSTOMER = new CustomerModel(); model.CUSTOMER.CUST_NO = custID; model.MSG = sms; model.TEL = tel; Database db = new Database(); MassageDAO mDAO = new MassageDAO(db); int i = mDAO.Add(model); db.Close(); // after inserted Send if (i > 0) { this.SmsSender(sms, tel); } return(Redirect("~/SysSms/SmsCustomer?custID=" + custID)); }