protected void btnSubmit_Click(object sender, EventArgs e)
        {
            int result = 0;
            Subscriber subsriber = new Subscriber
            {
                EmailAddress = txtEmailAddress.Text,
                IsActive = true,
                CreatedAt = DateTime.Now,
            };
            SubscriberCRUD subscriberCrud = new SubscriberCRUD();
            Subscriber isExists = subscriberCrud.GetList()
                .Where(x => x.EmailAddress == txtEmailAddress.Text)
                .FirstOrDefault();

            if (isExists == null)
            {
                result = subscriberCrud.Add(subsriber);
            }
            else if (!isExists.IsActive)
            {
                isExists.IsActive = !isExists.IsActive;
                subscriberCrud.Update(isExists);
            }

            if (result == -1)
            {
                Response.Redirect("~/Default.aspx?IsSuccess=SubscribeError");
            }
            Response.Redirect("~/Default.aspx?IsSuccess=SubscribeSuccess");
        }
 public List<Subscriber> GetListOFSubscribers()
 {
     SubscriberCRUD subscriberCrud = new SubscriberCRUD();
     List<Subscriber> subscribers = subscriberCrud.GetList()
     .Where(x => x.IsActive == true)
     .OrderBy(x => x.Id)
     .ToList();
     return subscribers;
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         SubscriberCRUD subscriberCrud = new SubscriberCRUD();
         Subscriber subscriber = subscriberCrud.GetList()
              .Where(x => x.Id == PageID)
              .FirstOrDefault();
         if (subscriber != null)
         {
             txtEmail.Text = subscriber.EmailAddress;
             txtIsActive.Text = subscriber.IsActive.ToString();
             txtCreatedAt.Text = subscriber.CreatedAt.ToString();
             txtUpdatedAt.Text = subscriber.UpdatedAt.ToString();
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SubscriberCRUD subscriberCrud = new SubscriberCRUD();

                List<string> listOfAddresses = (subscriberCrud.GetList()
                .Where(x => x.IsActive == true))
                .Select(x => x.EmailAddress)
                .ToList();

                listOfAddresses.ForEach(address =>
                {
                    lblAddresses.Text += address + ", ";
                });
            }
        }