コード例 #1
0
        public ActionResult UseAssetsForDeltas(IEnumerable <JAssetDeltas> deltas)
        {
            string publicID = EstadoUsuario.CurrentListPublicId;

            IEnumerable <string> szdeltas = this.Request.Params.AllKeys.Where(k => k.StartsWith("deltas["));

            List <KeyValuePair <int, int> > assets = new List <KeyValuePair <int, int> >();

            int cont  = 0;
            int id    = 0;
            int units = 0;

            foreach (var item in szdeltas)
            {
                if (cont == 0)
                {
                    id = int.Parse(this.Request.Params[item]);
                    cont++;
                }
                else
                {
                    units = int.Parse(this.Request.Params[item]);
                    assets.Add(new KeyValuePair <int, int>(id, units));
                    cont = 0;
                }
            }

            AgenteShoppingList agente = new AgenteShoppingList();

            agente.UseAssetsForDeltas(publicID, assets);
            return(null);
        }