public async void LoadDetails(string pedido)
        {
            var result = await services.GetDetailByCode(pedido);

            if (result != null)
            {
                Details     = new ObservableCollection <OrderReqDetailExtend>(result.Detail);
                Pedido      = pedido;
                ClientName  = result.ClientName;
                Observation = result.Observation;
            }
        }
        public async Task <ActionResult> Add(string code)
        {
            _services = new ProductChangeServices();
            var order = new OrderReqExtend();

            if (!string.IsNullOrEmpty(code))
            {
                order = await _services.GetDetailByCode(code);
            }
            else
            {
                return(View("Index"));
            }


            return(View(order));
        }
        public async Task <ActionResult> OrderDetails(List <OrderReqDetailExtend> aModel, string order, string prod, string prodChan, string prodChanNam, int?qty)
        {
            if (!string.IsNullOrEmpty(order))
            {
                _services = new ProductChangeServices();
                var result = new OrderReqExtend();
                var list   = new List <OrderReqDetailExtend>();
                result = await _services.GetDetailByCode(order);

                if (result != null)
                {
                    var op = Session["OptionCRUD"].ToString();

                    if (op == "INS")
                    {
                        result.Detail.Where(a => a.ProductCode == prod).ForEach(p =>
                        {
                            p.ProductCodeChanged = prodChan;
                            p.ProductNameChanged = prodChanNam;
                            if (qty != null)
                            {
                                p.Quantity = (int)qty;
                            }
                        });
                    }
                    else if (op == "DEL")
                    {
                        result.Detail.Where(a => a.ProductCode == prod).ForEach(p =>
                        {
                            p.ProductCodeChanged = null;
                            p.ProductNameChanged = null;
                            p.Quantity           = null;
                        });
                    }


                    //return PartialView("_Details", (IEnumerable<OrderReqDetailExtend>)result.Detail);
                    return(PartialView("_Details", result.Detail));
                }
            }

            //return PartialView("_Details", (IEnumerable<OrderReqDetailExtend>)aModel);
            return(PartialView("_Details", aModel));
        }