Ejemplo n.º 1
0
        public ActionResult Create(SalesCreateVM model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var  SalesList = Mapper.Map <Sales>(model);
                    bool isSaved   = _salesManager.Save(SalesList);
                    if (isSaved)
                    {
                        return(RedirectToAction("Create"));
                    }
                }
            }
            catch (Exception exception)
            {
                ModelState.AddModelError("", exception.Message);
                model.Items          = _itemManager.GetAll();
                model.Branches       = _branchManager.GetAll();
                model.EmployeeInfoes = _employeeInfoManager.GetAll();
                return(View(model));
            }

            model.Items          = _itemManager.GetAll();
            model.Branches       = _branchManager.GetAll();
            model.EmployeeInfoes = _employeeInfoManager.GetAll();
            return(View(model));
        }
Ejemplo n.º 2
0
        // GET: Sales/Create
        public ActionResult Create()
        {
            var model = new SalesCreateVM();

            model.Items          = _itemManager.GetAll();
            model.Branches       = _branchManager.GetAll();
            model.EmployeeInfoes = _employeeInfoManager.GetAll();
            return(View(model));
        }