public JsonResult ObtenerPedidosMes(string fechaInicio, string fechaFin) { var jsonResponse = new JsonResponse { Success = true }; var coincidencias = _figuraAppService.GetPedidosRangoFechas(fechaInicio, fechaFin); jsonResponse.Success = true; jsonResponse.Data = coincidencias; return Json(jsonResponse, JsonRequestBehavior.AllowGet); }
protected JsonResponse CastMessageView(ValidationResultDto validation) { var response = new JsonResponse { Success = validation.IsValid, Message = validation.IsValid ? PresentationResources.RegistroSatisfactorio : validation.ErrorMessage() }; return response; }
public JsonResult Registrar(FiguraDto figuraDto) { var jsonResponse = new JsonResponse(); figuraDto.RutaFisicaImagen = Server.MapPath("~/Figuras/"); var respuesta = figuraDto.Id == null ? _figuraAppService.Create(figuraDto) : _figuraAppService.Update(figuraDto); jsonResponse.Success = respuesta.IsValid; jsonResponse.Message = respuesta.ErrorMessage(); return Json(jsonResponse, JsonRequestBehavior.AllowGet); }
public void Process(MethodInterceptionArgs args, ILogger log) { var controller = (Controller)args.Instance; if (controller.ModelState.IsValid) { try { args.Proceed(); } catch (DefaultException ex) { log.Error(string.Format("Mensaje: {0} Trace: {1}", ex.Message, ex.StackTrace)); var jsonResponse = new JsonResponse { Message = ex.Message }; args.ReturnValue = new JsonResult { Data = jsonResponse, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; } catch (Exception ex) { string mensajeError = PresentationResources.DatosIncorrectos; log.Error(string.Format("Mensaje: {0} Trace: {1}", ex.Message, ex.StackTrace)); switch (ex.HResult) { case Constantes.Error2146233087: mensajeError = PresentationResources.NoSePuedeProcesar; break; } var jsonResponse = new JsonResponse { Message = mensajeError }; args.ReturnValue = new JsonResult { Data = jsonResponse, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; } } else { string message = string.Join("<br />", controller.ModelState.Values.SelectMany(p => p.Errors).Select(p => p.ErrorMessage)); var jsonResponse = new JsonResponse { Message = message }; args.ReturnValue = new JsonResult { Data = jsonResponse, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; } }
public void Process(MethodInterceptionArgs args, ILogger log) { try { args.Proceed(); } catch (Exception ex) { string mensajeError = PresentationResources.DatosIncorrectos; log.Error(string.Format("Mensaje: {0} Trace: {1}", ex.Message, ex.StackTrace)); switch (ex.HResult) { case Constantes.Error2146233087: mensajeError = PresentationResources.NoSePuedeProcesar; break; } var jsonResponse = new JsonResponse { Message = mensajeError }; args.ReturnValue = new JsonResult { Data = jsonResponse, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; } }