Esempio n. 1
0
        public async Task <ActionResult> Index(EmailNotifyViewModel model)
        {
            try
            {
                // Verification
                if (ModelState.IsValid)
                {
                    // Initialization.
                    string emailMsg     = "Dear " + model.ToEmail + ", <br /><br />This is a test <b style='color: red'> Account Notification </b><br />  Your account has been set up by our team, by default your password is: Test12345*<br /> " + "<a href = 'https://localhost:44398/Appointments'>Please login to change it </a> <br />" + "<br />Kind Regards, <br />CUH Appointments";
                    string emailSubject = EmailInfo.EMAIL_SUBJECT_DEFAULT + " Account Notification";

                    // Sending Email.
                    await this.SendEmailAsync(model.ToEmail, emailMsg, emailSubject);


                    // Info.
                    //return this.Json(new { EnableSuccess = true, SuccessTitle = "Success", SuccessMsg = "Notification has been sent successfully! to '" + model.ToEmail + "' Check your email." });
                    //return RedirectToAction("Success");
                    return(View("Success"));
                }
            }
            catch (Exception ex)
            {
                // Info
                Console.Write(ex);

                // Info
                return(this.Json(new { EnableError = true, ErrorTitle = "Error", ErrorMsg = ex.Message }));
            }

            // Info
            return(this.Json(new { EnableError = true, ErrorTitle = "Error", ErrorMsg = "Something goes wrong, please try again later" }));
        }
        public async Task <ActionResult> Index(EmailNotifyViewModel model)
        {
            try
            {
                // Verification
                if (ModelState.IsValid)
                {
                    // Initialization.
                    string emailMsg     = "Dear " + model.ToEmail + ", <br /><br />This is a test <b style='color: red'> Reminder </b> for your upcoming healthcare appointment. <br />  <a href = 'https://localhost:44350/Appointments'> Confirm </a><br /> " + "<a href = 'https://localhost:44350/Appointments'>Reschedule</a> <br />" + "<br />Kind Regards, <br />CUH Appointments";
                    string emailSubject = EmailInfo.EMAIL_SUBJECT_DEFAULT + " Appointment Notification";

                    // Sending Email.
                    await this.SendEmailAsync(model.ToEmail, emailMsg, emailSubject);


                    // Info.
                    //return this.Json(new { EnableSuccess = true, SuccessTitle = "Success", SuccessMsg = "Notification has been sent successfully! to '" + model.ToEmail + "' Check your email." });
                    //return RedirectToAction("Success");
                    return(View("Success"));
                }
            }
            catch (Exception ex)
            {
                // Info
                Console.Write(ex);

                // Info
                return(this.Json(new { EnableError = true, ErrorTitle = "Error", ErrorMsg = ex.Message }));
            }

            // Info
            return(this.Json(new { EnableError = true, ErrorTitle = "Error", ErrorMsg = "Something goes wrong, please try again later" }));
        }
Esempio n. 3
0
        public async Task <ActionResult> Index(EmailNotifyViewModel model)
        {
            try
            {
                // Verification
                if (ModelState.IsValid)
                {
                    // Initialization.
                    string emailMsg     = "Dear " + model.ToEmail + ", <br /><br /> Thist is test <b style='color: red'> Notification </b> <br /><br /> Thanks & Regards, <br />FashionShop";
                    string emailSubject = EmailInfo.EMAIL_SUBJECT_DEFAULT;

                    // Sending Email.
                    await this.SendEmailAsync(model.ToEmail, emailMsg, emailSubject);


                    // Info.
                    return(this.Json(new { EnableSuccess = true, SuccessTitle = "Success", SuccessMsg = "Notification has been sent successfully! to '" + model.ToEmail + "' Check your email." }));
                }
            }
            catch (Exception ex)
            {
                // Info
                Console.Write(ex);

                // Info
                return(this.Json(new { EnableError = true, ErrorTitle = "Error", ErrorMsg = ex.Message }));
            }

            // Info
            return(this.Json(new { EnableError = true, ErrorTitle = "Error", ErrorMsg = "Something goes wrong, please try again later" }));
        }
        public async Task <ActionResult> Index(EmailNotifyViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    string emailMessage = $"Dear " + model.ToMail + " ,<br/>" +
                                          "<br/> This is a test <b style='color:red'> Notification <br/><br/>" +
                                          " Thanks and regards. <br/>Itu Oli";

                    string emailSubj = EmaiInfo.EMAIL_SUBJECT_DEFAULT + " Test";

                    await this.SendEmailAsync(model.ToMail, emailMessage, emailSubj);

                    return(this.Json(new { EnableSuccess = true, SuccessTitle = "Success", SuccessMsg = "Notification sent successful" }));
                }
            }catch (Exception ex)
            {
                Console.Write(ex);
                return(this.Json(new { EnableError = true, ErrorTitle = "Error", ErrorMsg = ex.Message }));
            }

            return(this.Json(new { EnableError = true, ErrorTitle = "Error", ErrorMsg = "Something went wrong!" }));
        }