public string Delete(ModelDeleteVM model) { var http = (HttpWebRequest)WebRequest.Create(new Uri(_url)); http.Accept = "application/json"; http.ContentType = "application/json"; http.Method = "DELETE"; string parsedContent = JsonConvert.SerializeObject(model); UTF8Encoding encoding = new UTF8Encoding(); Byte[] bytes = encoding.GetBytes(parsedContent); Stream newStream = http.GetRequestStream(); newStream.Write(bytes, 0, bytes.Length); newStream.Close(); var response = http.GetResponse(); var stream = response.GetResponseStream(); var sr = new StreamReader(stream); var content = sr.ReadToEnd(); return(content); }
public Task <string> DeleteAsync(ModelDeleteVM make) { return(Task.Run(() => Delete(make))); }