public async Task Notity(Call call) { using (var httpClient = new HttpClient()) { var json = Json.Encode(call); var content = new StringContent(json); content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); await httpClient.PostAsync(string.Concat(GlobalSettings.Current.ObserverWebApiBaseUrl, "/call/notify"), content); } }
public void Notify(string callType) { var ip = Context.Request.Environment["server.RemoteIpAddress"].ToString(); var call = new Call { CreatedOn = DateTime.Now, CallType = callType, MacAddress = NativeMethods.GetMacAddress(ip), IpAddress = ip }; var callService = new CallService(); Task.Run(async () => await callService.Notity(call)); Clients.Caller.callRecieved(callType); }