title: IDictionary Controller and Interface C#
body: <p>I have an object coming back with multiple lists that looks like this:</p>
  <p><a href="https://i.stack.imgur.com/vrmkA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vrmkA.png" alt="enter image description here" /></a></p>
  <p>This is for a PUT route so I want to just sent it back with new value's. Keys can't change. I have worked with IEnumerables so most of the method logic is still geared towards that but before I even write that, I am trying to just make sure the dictionaries are getting to the method in my service and I haven't gotten there yet.</p>
  <p>I can't seem to get the syntax right when returning this in the MVC. I keep getting this error in the controller:</p>
  <p><a href="https://i.stack.imgur.com/37zGS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/37zGS.png" alt="error" /></a></p>
  <p>I have tried to await the products in the retObj but I just get an endless processing wheel and nothing happens. Any help on how to set this up?</p>
  <p><strong>Controller</strong></p>
  <pre><code>     [HttpPost(&quot;{operatorId}/products/{operatorRegionId?}&quot;)]
      [Authorize(Permissions.Admin.Operators.Update)]
      public async Task&lt;ActionResult&gt; PostOperatorPrices([FromRoute] string operatorId, [FromRoute] string operatorRegionId, [FromBody]  Task&lt;IDictionary&lt;string, List&lt;OperatorProductViewModel&gt;&gt;&gt; products)
      {
          var retObj = await _productService.AddOperatorProductPrices(operatorId, operatorRegionId, products, await _accountService.GetUserIdFromPrincipal(User));
          return new OkObjectResult(this._respService.packageResponse(retObj));
      }
  </code></pre>
  <p><strong>Interface in Service</strong></p>
  <pre><code>    Task&lt;IDictionary&lt;string, List&lt;OperatorProductViewModel&gt;&gt;&gt; AddOperatorProductPrices(string operatorId, string regionId, IDictionary&lt;string, List&lt;OperatorProductViewModel&gt;&gt; products, string userId);
  </code></pre>
  <p><strong>Method</strong></p>
  <pre><code>public async Task&lt;IDictionary&lt;string, List&lt;OperatorProductViewModel&gt;&gt;&gt; AddOperatorProductPrices(string operatorId, string regionId, IDictionary&lt;string, List&lt;OperatorProductViewModel&gt;&gt; products, string userId)
      {
          var retDictionary = new Dictionary&lt;string, List&lt;OperatorProductViewModel&gt;&gt;();
        //  List&lt;string&gt; productIds = new List&lt;string&gt;();
          foreach(var product in products)
          {
          //     OperatorRegionProductPrice myPrice = null;
          //     if (product.Id != null &amp;&amp; product.Id != &quot;&quot;)
          //     {
          //         myPrice = await _operatorRegionProductPriceRepo
          //             .GetSingleAsync(oppr =&gt; oppr.Id == product.Id);
          //     }
  
          //   //  if (myPrice == null) {
          //         myPrice = new OperatorRegionProductPrice{
          //             Id = _idService.GetIdString(),
          //             EffectiveDate = 
          //             new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Local)
          //              .AddSeconds(Convert.ToDouble(product.EffectiveDate)),
          //             IsTaxable = product.isTaxable,
          //             TenantId = TenantId,
          //             OperatorId = operatorId,
          //             RegionId = regionId,
          //             OperatorPrice = product.Price.GetValueOrDefault(),
          //             OperatorCost = product.Cost.GetValueOrDefault(),
          //             UpdateUserId = userId,
          //             CreateUserId = userId,
          //             ItemId = product.ProductId,
          //         };
              //     _operatorRegionProductPriceRepo.Add(myPrice);
            
              
              // productIds.Add(myPrice.Id);
          }
      //    await DeleteOperatorProductPrices(operatorId, regionId, products);
          await _operatorRegionProductPriceRepo.CommitAsync();
          return retDictionary;
      }
  </code></pre>