Пример #1
0
        public Group Insert(Group entity, int userId)
        {
            HttpContent content = new StringContent(JsonConvert.SerializeObject(entity));

            content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

            HttpResponseMessage responseMessage = httpClient.PostAsync("Group/create/" + userId, content).Result;

            responseMessage.EnsureSuccessStatusCode();

            string json = responseMessage.Content.ReadAsStringAsync().Result;

            G.Group newGroup = JsonConvert.DeserializeObject <G.Group>(json);
            return(newGroup.ToClient());
        }
Пример #2
0
 internal static Group ToClient(this G.Group entity)
 {
     return(new Group(entity.Id, entity.Name));
 }