// // GET: /Order/Delete/5 public ActionResult Delete(int id) { Order order = _repository.Get(id); var orderViewModel = new OrderViewModel { Id = order.Id, CustomerId = order.CustomerId, Amount = order.Amount, ModifiedDate = order.ModifiedDate }; return View(orderViewModel); }
public ActionResult Create(int customerId, Order order) { try { _repository.Add(customerId, order); var orderViewModel = new OrderViewModel { Id = order.Id, CustomerId = order.CustomerId, Amount = order.Amount, ModifiedDate = order.ModifiedDate }; return RedirectToAction("Index", orderViewModel); } catch { return View(); } }
public ActionResult Delete(int id, Order order) { try { Order toDelete = _repository.Get(id); _repository.Delete(id); var orderViewModel = new OrderViewModel { Id = order.Id, CustomerId = toDelete.CustomerId, Amount = toDelete.Amount, ModifiedDate = toDelete.ModifiedDate }; return RedirectToAction("Index", orderViewModel); } catch { return View(); } }
// // GET: /Order/Details/5 public ActionResult Details(int id) { Order order = _repository.Get(id); var orderViewModel = new OrderViewModel { Id = order.Id, CustomerId = order.CustomerId, Amount = order.Amount, ModifiedDate = order.ModifiedDate }; return orderViewModel.Id > 0 ? View(orderViewModel) : View("No data found"); }