// // GET: /Order/ public ActionResult Index(Guid customerId) { var orderRepository = new OrderRepository(); var customerRepository = new CustomerRepository(orderRepository); var customer = customerRepository.FindBy(customerId); return View(customer.Orders); }
public ActionResult DeleteConfirmed(Guid id) { var orderRepository = new OrderRepository(); var customerRepository = new CustomerRepository(orderRepository); try { //TODO //customerRepository.Delete(id); } catch (Exception ex) { return HttpNotFound(ex.Message); } return RedirectToAction("Index"); }
// // GET: /Customer/Delete/5 public ActionResult Delete(Guid? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } var orderRepository = new OrderRepository(); var customerRepository = new CustomerRepository(orderRepository); var customer = customerRepository.FindBy(id.Value); if (customer == null) { return HttpNotFound(); } return View(customer); }
public ActionResult Create([Bind(Include = "Id,Name")] Customer customer) { if (ModelState.IsValid) { customer.Id = Guid.NewGuid(); try { var orderRepository = new OrderRepository(); var customerRepository = new CustomerRepository(orderRepository); //TODO //customerRepository.Create(customer); } catch (Exception ex) { return HttpNotFound(ex.Message); } return RedirectToAction("Index"); } return View(customer); }
// // GET: /Customer/ public ActionResult Index() { var orderRepository = new OrderRepository(); var customerRepository = new CustomerRepository(orderRepository); var customers = customerRepository.FindAll(); return View(customers); }
public ActionResult Edit([Bind(Include = "Id,Name")] Customer customer) { if (ModelState.IsValid) { var orderRepository = new OrderRepository(); var customerRepository = new CustomerRepository(orderRepository); //TODO //customerRepository.SaveChanges(customer); return RedirectToAction("Index"); } return View(customer); }