Example #1
0
        public ActionResult FromOrder()
        {
            var user = db.Users.Where(u => u.UserName == User.Identity.Name).FirstOrDefault();

            ViewBag.OrderId = new SelectList(CombosHelper.GetOrders(user.CompanyId), "OrderId", "OrderId");
            return(PartialView());
        }
Example #2
0
        public ActionResult FromOrder(AddFromOrder view)
        {
            var user = db.Users.Where(u => u.UserName == User.Identity.Name).FirstOrDefault();

            if (ModelState.IsValid)
            {
                var response = MovementsHelper.SaleFromOrder(view.OrderId, User.Identity.Name);
                if (response.Succeeded)
                {
                    var newView = new NewSaleView
                    {
                        OrderId    = view.OrderId,
                        CustomerId = response.CustomerId,
                        Date       = response.Date,
                        Remarks    = response.Remarks,
                        Details    = db.SaleDetailTmps.Where(sdt => sdt.UserName == User.Identity.Name).ToList(),
                    };
                    //return PartialView(newView);
                    TempData["model"] = newView;
                    return(RedirectToAction("Create"));
                }
                ModelState.AddModelError(string.Empty, response.Message);
            }
            ViewBag.OrderId = new SelectList(CombosHelper.GetOrders(user.CompanyId), "OrderId", "OrderId");
            return(PartialView());
        }