Beispiel #1
0
        public ActionResult Index()
        {
            try
            {
                var model = new SortAndPageModel
                {
                    CurrentPageIndex = 1,
                    SortBy           = DefaultSortBy,
                    SortDescending   = false
                };

                int totalRecords;
                ViewBag.Invoice        = _invoice.GetAllInvoice(out totalRecords);
                model.TotalRecordCount = totalRecords;
                ViewBag.SortAndPage    = model;
                var searchInvoiceModel = new SearchInvoiceModel()
                {
                    ListNo = ListNos()
                };
                return(View(searchInvoiceModel));
            }
            catch (Exception ex)
            {
                TempData["Error"] = ex.ToString();
                return(RedirectToAction("Index", "Error", new { area = "" }));
            }
        }
 public ActionResult SearchInvoice(SearchInvoiceModel model)
 {
     if (ModelState.IsValid)
     {
         var order = db.Orders.SingleOrDefault(e => e.OId == model.OId);
         if (order == null)
         {
             ModelState.AddModelError("", "Không tìm thấy đơn hàng nào!");
             return(View(model));
         }
         else
         {
             return(RedirectToAction("Invoice", new { OId = model.OId }));
         }
     }
     return(View(model));
 }