public ActionResult AddCustomer(string name, string alamat, string kota, string negara, string kodepos, string email) { try { Customer cust = new Customer() { Name = name, Alamat = alamat, Kota = kota, Negara = negara, KodePos = kodepos, Email = email, Outstanding = 0 }; CustomerRepository.AddCustomer(cust); return RedirectToAction("Index", "Customer"); } catch (ApplicationException ex) { return View(ex.Message); } }
public void UpdateCustomer(Customer cust) { string query = String.Format("UPDATE tblcustomer set name = '{0}',alamat = '{1}',kota = '{2}',negara = '{3}',kodepos = '{4}',email = '{5}' where id = '{6}'", cust.Name, cust.Alamat, cust.Kota, cust.Negara, cust.KodePos, cust.Email, cust.Id); qryObjectMapper.Map<Customer>(query); }
public void AddCustomer(Customer cust) { string query = String.Format("INSERT INTO tblcustomer (name,alamat,kota,negara,kodepos,email,outstanding) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}')", cust.Name, cust.Alamat, cust.Kota, cust.Negara, cust.KodePos, cust.Email, cust.Outstanding); qryObjectMapper.Map<Customer>(query); }
public ActionResult UpdateCustomer(Customer cust) { try { CustomerRepository.UpdateCustomer(cust); return RedirectToAction("Index", "Customer"); } catch (ApplicationException ex) { return View(ex.Message); } }