Beispiel #1
0
        public JsonResult BuscaForcaTrabalho(string chave)
        {
            try
            {
                string json = string.Empty;

                JsonSerializerSettings js = new JsonSerializerSettings();
                js.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;

                var dados = _pedidoAppService.BuscarForcaTrabalho(chave);

                if (dados != null)
                {
                    json = JsonConvert.SerializeObject(dados, Formatting.None, js);
                }

                return(Json(new { Status = HttpStatusCode.OK, Dados = json }, JsonRequestBehavior.AllowGet));
            }
            catch (BusinessException ex)
            {
                return(Json(new { Status = HttpStatusCode.BadRequest, Codigo = 0, Mensagem = ex.Message }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType).Error(ex);
                return(Json(new { Status = HttpStatusCode.InternalServerError, Codigo = 0, Mensagem = ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }