Пример #1
0
        protected JsonResponse CastMessageView(ValidationResultDto validation)
        {
            var response = new JsonResponse();
            response.Success = validation.IsValid;

            response.Message = validation.IsValid
                ? Constantes.RegistroSatisfactorio
                : validation.ErrorMessage();

            return response;
        }
Пример #2
0
        public JsonResult EnviarEmail(EnvioMensajeDTO model)
        {
            var response = new JsonResponse();
            try
            {
                string ruta = string.Format("{0}{1}.html", Constantes.EmailTemplate, Constantes.FormularioEnvio);
                string listaEmail = string.Format("{0};{1}", ConfigurationManager.AppSettings[Constantes.EmailFTPTo], model.Email);
                Email.From(ConfigurationManager.AppSettings[Constantes.EmailFTPFrom])
                    .To(listaEmail)
                    .Subject(Constantes.TituloFormulario)
                    .UseSSL()
                    .UsingTemplateFromFile<FormularioEnvioModel>(ruta,
                    new FormularioEnvioModel
                    {
                        Name = model.Name,
                        LastName = model.LastName,
                        Dni = model.Dni,
                        Phone = model.Phone,
                        Correo = model.Email,
                        Legal = "Sí",
                        Aplicacion = Constantes.Aplicacion,
                        Mensaje = model.Mensaje,
                        Titulo = Constantes.TituloFormulario
                    })
                    .Send();
                response.Success = true;
                response.Message = Constantes.EnvioSatisfactorio;
            }
            catch (Exception ex)
            {
                response.Message = Constantes.OcurrioError;
                Logger.Error(ex.Message);
            }

            return Json(response);
        }