public IActionResult Remove(Guid id) { using (var db = new AllInOneContext.AllInOneContext()) { using (var transaction = db.Database.BeginTransaction()) { try { TimerTask delObj = db.TimerTask.FirstOrDefault(t => t.TimerTaskId.Equals(id)); if (delObj == null || !delObj.PlanId.Equals(id)) { return(NotFound()); } db.TimerTask.Remove(delObj); db.SaveChanges(); transaction.Commit(); //移除任务服务器的预案 string url = string.Format("{0}/Task/PlanAction/{1}", GlobalSetting.TaskServerBaseUrl, id); string responseContent = ""; HttpClientHelper.Delete(url, ref responseContent); return(NoContent()); } catch (Exception ex) { transaction.Rollback(); _logger.LogError("删除定时任务异常,Message:{0}\r\nStackTrace:{1}", ex.Message, ex.StackTrace); return(BadRequest(ex)); } } } }
private void View_Delete(object pram) { HttpClientHelper clientHelper = new HttpClientHelper(); clientHelper.Delete($"/Candidate/{View.SelectedCandidateId}"); Show(); }
public bool Delete(int addressId, string authenticationToken) { using (var svc = new HttpClientHelper()) { var result = JsonHelper.DeserializeJson<bool>(svc.Delete(Constants.BlogRestUrl, string.Format("address/{0}", addressId), authenticationToken)); return result; } }
public ActionResult Del(string id) { if (hc.Delete("api/music/" + id) == "1") { return(Content("<script>alert('删除成功');location.href='/music/Show'</script>")); } else { return(Content("<script>alert('删除失败');</script>")); } }
private void StopPlan(Guid planId) { try { string url = string.Format("{0}/Task/PlanAction/Stop/planId={1}", GlobalSetting.TaskServerBaseUrl, planId); string error = ""; bool b = HttpClientHelper.Delete(url, ref error); _logger.LogInformation("调用{0}停止预案,Error:{1}", url, error); } catch (Exception ex) { _logger.LogError("停止预案异常:Message:{0}\r\nStackTrace:{1}", ex.Message, ex.StackTrace); } }
public void DeleteRecoed(int Id) { string str = helper.Delete("api/Record/DeleteRecoed/?Id=" + Id); int i = int.Parse(str); if (i > 0) { Response.Write("<script>alert('删除成功');location.href='/Record/Index/';</script>"); } else { Response.Write("<script>alert('删除失败');location.href='/Record/Index/';</script>"); } }
public void Delete(string id, string language, Type type, string indexName = null) { if (indexName == null) { indexName = _settings.GetDefaultIndexName(language); } var uri = $"{_settings.Host}/{indexName}/{type.GetTypeName()}/{id}"; var exists = HttpClientHelper.Head(new Uri(uri)) == HttpStatusCode.OK; if (exists) { HttpClientHelper.Delete(new Uri(uri)); Refresh(language); } }
public Response <bool> Delete(string path, int id) { return(HttpClientHelper.Delete(path, id)); }