/// <summary> /// Delete连接 /// </summary> private void DelLink() { int id = CRequest.GetInt("id", 0); int num = LinksService.Delete(id); if (num > 0) { Response.Redirect("/admin/link.aspx"); } }
public HttpResponseMessage Delete(int id) { bool res = false; LinksService svc = new LinksService(); try { res = svc.Delete(id); return(Request.CreateResponse(HttpStatusCode.OK, res)); } catch (System.Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
private void MiLinkElimina_Click(object sender, RoutedEventArgs e) { if (dgLinks.SelectedIndex == -1) { return; } Link l = (Link)dgLinks.SelectedItem; MessageBoxResult res = MessageBox.Show("Eliminare il link " + l.Titolo + "?", "", MessageBoxButton.YesNo, MessageBoxImage.Question); if (res == MessageBoxResult.Yes) { linksService.Delete(l.IdLink); LoadCategorie(categoriaService.GetAll()); } }
/// <summary> /// 控件行命令事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void repInfo_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName.Equals("del")) { int id = Convert.ToInt32(e.CommandArgument); LinksService.Delete(id); LoadData(); } if (e.CommandName.Equals("mod")) { int id = Convert.ToInt32(e.CommandArgument); Links item = LinksService.GetModel(id); if (item != null) { DataSet ds = NewsTypeService.GetList(4, "parentId = 2", "id"); int flag = 0; if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { if (Convert.ToInt32(dr["id"]) == item.istj) { flag = 1; break; } } } if (flag == 1) { ddlPlace.SelectedValue = item.istj.ToString(); } txtLinkUrl.Text = item.linkurl; txtLinkTitle.Text = item.linktitle; txtLinkName.Text = item.linkname; lblId.Text = item.id.ToString(); pnlAdd.Visible = true; pnlList.Visible = false; } } }