public async Task <ActionResult> SendMail(string subject, string to, string body)
        {
            var vm = new IndexViewMail();

            try
            {
                var result = await _mailAppService.SendMailAsync(Session["Token"].ToString(), subject, to, body);

                if (result)
                {
                    isSendSuccess = true;
                }
                else
                {
                    isSendSuccess = false;
                }
            }
            catch (Exception ex)
            {
                if (ex.Data == null)
                {
                    throw;
                }
                isSendSuccess = false;
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Index()
        {
            if (Session["Token"] != null)
            {
                //Session["Email"] = await GetUserDetails();
                // email = await GetUserDetails();
                //get list mail
                var listMail = await GetMail();


                var model = new IndexViewMail(listMail, Session["Email"].ToString(), true);
                model.isAuthenticated = true;
                return(View(model));
            }
            else
            {
                var model = new IndexViewMail();
                return(View(model));
            }
        }
Exemplo n.º 3
0
        public async Task <ActionResult> SendMail(string subject, string to, string body, string from)
        {
            var vm = new IndexViewMail();

            try
            {
                _gmailAppService.SendMailAsync(Session["Token"].ToString(), subject, to, body, Session["Email"].ToString());
                //if (result)
                //    vm.IsSendSuccess = true;
                //else
                //    vm.IsSendSuccess = false;
            }
            catch (Exception ex)
            {
                if (ex.Data == null)
                {
                    throw;
                }
                vm.IsSendSuccess = false;
            }
            return(RedirectToAction("Index", new { isSendSuccess = vm.IsSendSuccess }));
        }