Пример #1
0
 public ActionResult Edit(string id, FormCollection collection)
 {
     var customerRepository = new CustomerRepository(new Context());
     Customer customer = customerRepository.Read(id);
     UpdateModel(customer);
     try
     {
         customerRepository.Update(customer);
         return RedirectToAction("Details", new {id = id});
     }
     catch (Exception ex)
     {
         ModelState.AddModelError(string.Empty, ex.Message);
     }
     return View(customer);
 }
Пример #2
0
 public ActionResult Search(string companyName, string contactName, string contactTitle)
 {
     var customers = new Customer[0];
     try
     {
         customers = new CustomerRepository(new Context()).Search(companyName, contactName, contactTitle);
     }
     catch (Exception ex)
     {
         ModelState.AddModelError(string.Empty, ex.Message);
     }
     return PartialView("SearchPartial", customers);
 }
Пример #3
0
 //
 // GET: /Customer/Edit/5
 public ActionResult Edit(string id)
 {
     Customer customer = new CustomerRepository(new Context()).Read(id);
     return View(customer);
 }