Beispiel #1
0
 public ActionResult CustomerForm(FormCollection fc)
 {
     // int cid=0;
     if (fc["btnInsert"] == "Insert")
     {
         //if (fc["txtCity"] != "")
         //{
         //    cid = int.Parse(fc["txtCity"]);
         //}
         Customer customer = new Customer()
         {
             Name    = fc["txtName"],
             Address = fc["txtAddress"],
             CityID  = int.Parse(fc["txtCity"]),
             //CityID = cid,
             IsActive = bool.Parse(fc["txtStatus"])
         };
         Cc.AddCustomer(customer);
     }
     else if (fc["btnUpdate"] == "Update")
     {
         Customer customer = new Customer()
         {
             CustomerID = int.Parse(fc["txtCustomerID"]),
             Name       = fc["txtName"],
             Address    = fc["txtAddress"],
             CityID     = int.Parse(fc["txtCity"]),
             IsActive   = bool.Parse(fc["txtStatus"])
         };
         Cc.UpdateCustomer(customer);
     }
     return(RedirectToAction("CustomerForm"));
 }
Beispiel #2
0
 public bool AddCustomer(CustomerModel customerModel)
 {
     return(_customer.AddCustomer(customerModel));
 }