Esempio n. 1
0
        public JsonResult EmailSetup(EmailSetupModel model)
        {
            if (ModelState.IsValid)
            {
                var response = _siteSetupService.SaveEmailSetupModel(model);

                return(Json(response));
            }

            return(Json(new ResponseModel
            {
                Success = false,
                Message = ModelState.BuildValidationMessages()
            }));
        }
Esempio n. 2
0
        /// <summary>
        /// Save email setup
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResponseModel SaveEmailSetupModel(EmailSetupModel model)
        {
            ResponseModel response;

            try
            {
                Mapper.CreateMap <EmailSetupModel, EmailAccount>();
                var emailAccount = Mapper.Map <EmailSetupModel, EmailAccount>(model);
                emailAccount.IsDefault = true;

                response = _emailAccountRepository.Insert(emailAccount);
            }
            catch (Exception exception)
            {
                response = new ResponseModel
                {
                    Success = false,
                    Message = exception.Message
                };
            }

            return(response);
        }