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()); }
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)); }