public async Task<ActionResult> Submit(RefundApplication refundApplication)
        {
            var home = Umbraco.TypedContentAtRoot().First();
            var settings = Umbraco.TypedContent(1091);

            var email = home.GetProperty("mailTo").Value.ToString();
            var emailFrom = settings.GetProperty("fromEmail").Value.ToString();
            var smtpServer = settings.GetProperty("smtpServer").Value.ToString();
            var smtpUsername = settings.GetProperty("smtpUsername").Value.ToString();
            var smtpPassword = settings.GetProperty("smtpPassword").Value.ToString();

            refundApplication.ApplicationDate = SetDateForMongo(DateTime.Now);
            var refundApplicationRepository = new RefundApplicationRepository();
            await refundApplicationRepository.CreateSync(refundApplication);

            var mailService = new MailService();
            mailService.Send(email, Server.MapPath("~/RegistrationNotification.html"), "", refundApplication, smtpServer, smtpUsername, smtpPassword, emailFrom);

            return Json(new { success = true, responseText = "Added." }, JsonRequestBehavior.AllowGet);
        }
Пример #2
0
 public async Task<ActionResult> ForgotPassword(string email)
 {
     var refundAppRepo = new RefundApplicationRepository();
     var existing = await refundAppRepo.FindByEmail(email);
     if (existing.Count > 0)
     {
         var password = existing.FirstOrDefault().Password;
         var mail = new MailService();
         mail.SendPassword(email, password);
         Response.StatusCode = (int)HttpStatusCode.OK;
         return Json(new
         {
             success = true
         }, JsonRequestBehavior.AllowGet);
     }
     else
     {
         Response.StatusCode = (int)HttpStatusCode.BadRequest;
         return Json(new { success = false, responseText = "User already exist." }, JsonRequestBehavior.AllowGet);
     }
 }