protected void Page_Init(object sender, EventArgs e) { Session["Active"] = "GiftCardList"; if (!IsPostBack) { Session["CurrentPage"] = 1; RptGiftCardListing.DataSource = _giftCardRepository.GetAll().OrderBy(x => x.Status).ThenByDescending(x => x.Id).Take(Constant.ItemPerPage); RptGiftCardListing.DataBind(); } }
protected virtual void btnDelete_Click(object sender, EventArgs e) { var repo = GiftCardRepository; var cards = GiftCardRepository.GetAll(); foreach (var card in cards) { repo.Delete(card); } repo.Flush(); BindResults(); }