Ejemplo n.º 1
0
        // GET: Base
        protected JsonResult RetornarMensagem(string mensagem, MensagemTipo tipo, long?idEntidade = null, string redirect = null, string callback = null)
        {
            string id = string.Empty;

            if (idEntidade.HasValue)
            {
                id = idEntidade.Value.ToString();
            }

            var retorno = new
            {
                id          = id,
                sucesso     = tipo == MensagemTipo.Sucesso ? true : false,
                tipo        = tipo.ToString(),
                mensagem    = mensagem,
                redirect    = !string.IsNullOrEmpty(redirect),
                urlRedirect = !string.IsNullOrWhiteSpace(redirect) ? redirect : string.Empty,
                callBack    = !string.IsNullOrWhiteSpace(callback) ? callback : string.Empty,
            };

            var json = new JsonResult();

            json.Data = retorno;
            json.JsonRequestBehavior = JsonRequestBehavior.AllowGet;

            return(json);
        }
 public GenericCommandResult(bool sucesso, string mensagem, MensagemTipo mensagemtipo, object dados)
 {
     Sucesso      = sucesso;
     Mensagem     = mensagem;
     MensagemTipo = mensagemtipo;
     Objeto       = JsonConvert.SerializeObject(dados);
 }
Ejemplo n.º 3
0
 public BusinessException(string message, MensagemTipo tipo, Exception ex)
     : base(message, ex)
 {
     this.Message = message;
     this.Tipo    = tipo;
 }