public IActionResult Edit(EmailSubscribeEditModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var dbModel = _emailSubscriptionRepository.Get(model.EmailSubscriptionId);

            dbModel.Email        = model.Email;
            dbModel.IsSubscribed = model.IsSubscribed;

            _emailSubscriptionRepository.Update(dbModel);

            return(RedirectToAction("index"));
        }
        public IActionResult UnSubscribe(EmailSubscribeModel model)
        {
            if (!ModelState.IsValid)
            {
                throw new Exception("invalid email submission");
            }

            var emailDbModel = _emailSubscriptionRepository.Get(model.Email);

            if (emailDbModel != null)
            {
                emailDbModel.IsSubscribed = false;

                _emailSubscriptionRepository.Update(emailDbModel);

                ViewBag.Success = true;
            }

            return(View());
        }