Example #1
0
        public ContentResult SendToSupport(string subject, string text)
        {
            bool saveResult = false;
            string error;
            try
            {

                if (string.IsNullOrEmpty(text))
                    error = "Не заполнено поле 'Текст сообщения'.";
                else if (text.Length > MaxSupportMessageLength)
                    error = string.Format("Поле 'Текст сообщения' не может быть более {0} символов.",MaxSupportMessageLength);
                else
                {
                    var model = new SendToSupportModel { Subject = subject, Text = text };
                    saveResult = LoginBl.SendToSupport(model);
                    error = model.Error;
                }
            }
            catch (Exception ex)
            {
                Log.Error("Exception on SendToSupport:", ex);
                error = ex.GetBaseException().Message;
                saveResult = false;
            }
            JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
            var jsonString = jsonSerializer.Serialize(new SaveTypeResult { Error = error, Result = saveResult });
            return Content(jsonString);
        }
Example #2
0
        public bool SendToSupport(SendToSupportModel model)
        {
            try
            {
                SendEmail(model, null, model.Subject, model.Text);
                if(!string.IsNullOrEmpty(model.EmailDto.Error))
                {
                    model.Error = model.EmailDto.Error;
                    return false;
                }
                return true;
            }
            catch (Exception ex)
            {

                Log.Error("Exception:",ex);
                model.Error = "Исключение: " + ex.GetBaseException().Message;
                return false;
            }
        }