コード例 #1
0
        public Event Insert(Event entity)
        {
            HttpContent content = new StringContent(JsonConvert.SerializeObject(entity));

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

            HttpResponseMessage responseMessage = httpClient.PostAsync("Event/create", content).Result;

            responseMessage.EnsureSuccessStatusCode();

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

            G.Event newEvent = JsonConvert.DeserializeObject <G.Event>(json);
            return(newEvent.ToClient());
        }
コード例 #2
0
 internal static Event ToClient(this G.Event entity)
 {
     return(new Event(entity.Id, entity.Name, entity.Film, entity.DateEvent, entity.GroupId, entity.IsDateValid, entity.IsFilmValid));
 }