I am programming a web-service with Asp.Net MVC4. I am using WinForms for the Client. I have implemented a SearchController that is able to return a list of Items.
[HttpGet]
public IEnumerable<Shared.Item> ByTag(string search)
{
ModelDbContext db = ModelDbContext.Current;
db.Items.Load();
//find some items....
return itemList;
}
I am calling it like this:
public Task<IEnumerable<Item>> SearchByTag(string tag)
{
client.BaseAddress = serviceAdress;
var getStuffCall=client.GetAsync("Search/ByTag/" + tag);
var r=getStuffCall.ContinueWith(
t =>t.Result.IsSuccessStatusCode? (t.Result.Content.ReadAsAsync<IEnumerable<Item>>().Result):new List<Item>()
);
return r;
}
This works fine. Now I would like to upload also an Item to the server. The problem is, that my type Item is structured and also contains a list of files and a list of pictures. As far as I understood, this does not work with a json-object. Or can I somehow wrap/encode my files and pictures?