コード例 #1
0
ファイル: CustomerController.cs プロジェクト: faychan/fay
 ////[AuthorizeRoles("Admin")]
 public ActionResult Add(addCustomerView acv)
 {
     if (ModelState.IsValid)
     {
         CustomerManager CM = new CustomerManager();
         CM.AddCustomer(acv);
         return(RedirectToAction("Index", "Home"));
     }
     else
     {
         ViewBag.isError = true;
     }
     return(View());
 }
コード例 #2
0
ファイル: CustomerManager.cs プロジェクト: faychan/fay
        public void AddCustomer(addCustomerView c)
        {
            using (DemoEntities1 db = new DemoEntities1())
            {
                pelanggan p = new pelanggan();
                p.no_id   = c.no_id;
                p.nama    = c.nama;
                p.alamat  = c.alamat;
                p.no_tlp1 = c.no_tlp1;
                p.no_tlp2 = c.no_tlp2;

                db.pelanggans.Add(p);
                db.SaveChanges();
            }
        }