vendredi 10 juin 2016

What to do in this situation?

I have a class company

public class Company : EntityBase
{
    [JsonProperty("id")]
    public int Id { get; set; }
    [JsonProperty("name")]
    public string Name { get; set; }
    [JsonProperty("address")]
    [JsonProperty("types")]
    public Array TypesArray { get; set; }
    ...

Use the query I get JSON, containing property - types of the form

[1,2,3,4]..

This array of Id category In the view I need to display a list of categories owned by the company. To do this in ViweModel I make a request for all the categories and select needs.Then I form an anonymous objects in observable collection.

new ObservableCollection<object>
      {
          Company:Company,
          Categories:categories
      }

I recently went with JavaScript. But I think that in C # there is a way to find a more elegant solution than. Tell me what to do please.

Aucun commentaire:

Enregistrer un commentaire