Beispiel #1
0
 public ActionResult Terminal(TerminalVM model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var  terminal = Mapper.Map <Sell>(model);
             bool isSaved  = _sellManager.Save(terminal);
             if (isSaved)
             {
                 return(RedirectToAction("Payment"));
             }
         }
     }
     catch (Exception exception)
     {
         ModelState.AddModelError("", exception.Message);
         model.ItemCategories = _itemCategoryManager.GetAll();
         model.Items          = _itemManager.GetAll();
         return(View(model));
     }
     model.ItemCategories = _itemCategoryManager.GetAll();
     model.Items          = _itemManager.GetAll();
     return(View(model));
 }
Beispiel #2
0
        public ActionResult Payment(TerminalVM model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var terminal = Mapper.Map <Sell>(model);

                    bool isSaved = _sellManager.Update(terminal);
                    if (isSaved)
                    {
                        int id = terminal.Id;
                        return(RedirectToAction("Receit", new { id }));
                    }
                }
            }
            catch (Exception exception)
            {
                ModelState.AddModelError("", exception.Message);
                var sell = _sellManager.GetLastOrDefault(m => m.Id == m.Id);
                model = Mapper.Map <TerminalVM>(sell);
                return(View(model));
            }
            return(View(model));
        }
Beispiel #3
0
        public ActionResult Terminal()
        {
            var model = new TerminalVM();

            model.ItemCategories = _itemCategoryManager.GetAll();
            model.Items          = _itemManager.GetAll();
            return(View(model));
        }