protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int itemId = Convert.ToInt32(Request.Params["id"]); if (itemId != 0) { ArticleItem = DataHelper.GetOneArticle(itemId); } } }
public static void DeleteArticle(int id) { using (var ctx = new RentooloEntities()) { Articles obj = ctx.Articles.Single(x => x.Id == id); ctx.Articles.Remove(obj); try { ctx.SaveChanges(); } catch (System.Exception ex) { DataHelper.AddException(ex); } } }