示例#1
0
 //
 // 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);
 }
示例#2
0
 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();
     }
 }
示例#3
0
 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();
     }
 }
示例#4
0
 //
 // 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");
 }