예제 #1
0
        public ActionResult Delete(int id)
        {
            var m = new EmailModel(id);

            if (!m.CanDelete())
            {
                return(Redirect("/"));
            }
            DeleteEmail(id);
            return(Redirect("/Emails"));
        }
예제 #2
0
        public ActionResult DeleteQueued(int id)
        {
            var m = new EmailModel(id);

            if (m.queue == null)
            {
                return(Redirect("/Emails"));
            }
            if (m.queue.Sent.HasValue || !m.queue.SendWhen.HasValue || !m.CanDelete())
            {
                return(Redirect("/"));
            }
            DeleteEmail(id);
            return(Redirect("/Emails"));
        }
예제 #3
0
        public ActionResult DeleteQueued(int id)
        {
            var email = (from e in DbUtil.Db.EmailQueues
                         where e.Id == id
                         select e).Single();
            var m = new EmailModel {
                id = id
            };

            if (m.queue.Sent.HasValue || !m.queue.SendWhen.HasValue || !m.CanDelete())
            {
                return(Redirect("/"));
            }
            DbUtil.Db.EmailQueueTos.DeleteAllOnSubmit(email.EmailQueueTos);
            DbUtil.Db.EmailQueues.DeleteOnSubmit(email);
            DbUtil.Db.SubmitChanges();
            return(Redirect("/Manage/Emails"));
        }
예제 #4
0
        public ActionResult Requeue(int id)
        {
            var email = (from e in DbUtil.Db.EmailQueues
                         where e.Id == id
                         select e).Single();
            var m = new EmailModel {
                id = id
            };

            if (m.queue.Sent.HasValue || !m.queue.SendWhen.HasValue || !m.CanDelete())
            {
                return(Redirect("/"));
            }
            foreach (var et in email.EmailQueueTos)
            {
                et.Sent = null;
            }
            email.Sent = null;
            DbUtil.Db.SubmitChanges();
            return(Redirect("/Manage/Emails/Details/" + id));
        }