Esempio n. 1
0
        public MessageModel(Result result)
        {
            if (result.HasError)
            {
                this.Type = MessageType.Failure;
                this.Content = ResourceManager.GetString("Web.ViewModel.MessageModel.ErrorContent"); //An error has occurred while your request was being processed.

                if (result is Result<int>)
                {
                    var genericResult = (Result<int>)result;
                    if (genericResult.Data > 0)
                    {
                        this.Content += string.Format(" {0} : <b>{1}</b>.", ResourceManager.GetString("Web.ViewModel.MessageModel.ErrorCodeExtensionContent"), genericResult.Data);
                        
                    }
                }

                this.Content += string.Format("<br /><br />{0} : {1}", ResourceManager.GetString("Web.ViewModel.MessageModel.ErrorDetailsContent"), result.Message);
            }
            else
            {
                this.Type = MessageType.Information;

                if (string.IsNullOrEmpty(result.Message))
                {
                    this.Content = ResourceManager.GetString("Web.ViewModel.MessageModel.SuccessfullyContent"); //Your request has been processed successfully.
                }
                else
                {
                    this.Content = result.Message;
                }
            }
        }
Esempio n. 2
0
 public void WriteMessage(Result result)
 {
     WriteMessage(new MessageModel(result));
 }