Beispiel #1
0
        public ActionResult Create(NewSaleView view)
        {
            if (ModelState.IsValid)
            {
                var response = MovementsHelper.NewSale(view, User.Identity.Name);
                if (response.Succeeded)
                {
                    return(RedirectToAction("Index"));
                }
                ModelState.AddModelError(string.Empty, response.Message);
            }

            var user = db.Users.Where(u => u.UserName == User.Identity.Name).FirstOrDefault();

            ViewBag.CustomerId  = new SelectList(CombosHelper.GetCustomers(user.CompanyId), "CustomerId", "FullName");
            ViewBag.WarehouseId = new SelectList(CombosHelper.GetWarehouses(user.CompanyId), "WarehouseId", "Name");
            view.Details        = db.SaleDetailTmps.Where(sdt => sdt.UserName == User.Identity.Name).ToList();
            return(View(view));
        }