How to loop through list of complex type objects and pass to a method calling SQL Stored procedure
<p>How to loop through a list of objects in order to pass said object to a method inserting rows in SQL db via stored procedure?</p>

<p>With help <a href="https://stackoverflow.com/questions/35272514/issue-with-restful-webservice-jsonsql-stored-procedure-project">in this question</a> I got to this point:</p>

<pre><code>namespace NA.Controllers
{
   public class NC : ApiController
   {
      [Route("AddNote")]
      [HttpPost]
    public HttpResponseMessage PostNote(List&lt;Note&gt; items)
    {
        //NoteJson deserializednote = JsonConvert.DeserializeObject&lt;NoteJson&gt;(item);
        //Note notesdata = new Note(item);
        NotesAccept.Models.INoteRepository Repository = new NotesAccept.Models.NoteDataRepository();
        foreach (Note item in items)
        {

        item = Repository.Add(item);

        }
        var response = Request.CreateResponse&lt;List&lt;Note&gt;&gt;(HttpStatusCode.OK, items);
        return response;
    }
   }
}
</code></pre>

<p>but now I'm stuck as <code>item=</code> is now an iteration variable, but I need to pass it to an method:</p>

<pre><code>namespace NA.Models
{
  class NoteDataRepository : INoteRepository
  {
     public void Add(Note item)
     {
        if (item == null)
        {
            throw new ArgumentNullException("item");
        }
        else
        {
            String strConnString = ConfigurationManager.ConnectionStrings["conString"].ConnectionString;
            SqlConnection con = new SqlConnection(strConnString);
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "BL_IntegrationInsertNote";
            cmd.Parameters.Add("@Client", SqlDbType.VarChar).Value = item.Client.Trim();
            cmd.Parameters.Add("@Case", SqlDbType.VarChar).Value = item.Case;
            cmd.Parameters.Add("@Text", SqlDbType.VarChar).Value = item.Text.Trim();
            cmd.Parameters.Add("@When", SqlDbType.DateTime).Value = item.Date;
            cmd.Parameters.Add("@Ext", SqlDbType.Bit).Value = item.Type;
            cmd.Parameters.Add("@return", SqlDbType.Int).Direction = ParameterDirection.Output;
            cmd.Connection = con;

            try
            {
                con.Open();
                cmd.ExecuteNonQuery();
                string id = cmd.Parameters["@return"].Value.ToString();
                string lblMessage = null;
                lblMessage = "Record inserted successfully. ID = " + id;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
                con.Dispose();
            }
        }    
        //return item;
    }

    IEnumerable&lt;Note&gt; INoteRepository.GetAll()
    {
        throw new NotImplementedException("getitems");
    }
}
}
</code></pre>

<p>I'm still green-as-a-grass-newbie to C# so I've no idea how to accomplish that, especially since whole solution is still "copy&amp;Paste" from all over the web, and whole web curiously concentrates on looping through simple types. How to do that with complex type?</p>

<p>As noted in other question, this is a matter of professional life and death (I'm a db dev, not a VS guru, especially not after two days and two nights).</p>