public AddModalidadPagoResponseDTO AddModalidadPago(AddModalidadPagoRequestDTO modalidadPagoRequest) { AddModalidadPagoResponseDTO modalidadPagoResponse = new AddModalidadPagoResponseDTO(); modalidadPagoResponse.ListaModalidadPago = new List <CatModalidadPago>(); ModalidadPagoDal modalidadPagoDal = new ModalidadPagoDal(); int resultado = 0; foreach (CatModalidadPago modalidadPago in modalidadPagoRequest.ListaModalidadPago) { try { resultado = modalidadPagoDal.AddModalidadPago(modalidadPago.modalidadPago, modalidadPago.descripcion, modalidadPago.usuarioInsert); if (resultado > 0) { modalidadPago.mensaje = "OK"; } else { modalidadPago.mensaje = "Error: Ocurrio un problema y no se edito la informacion de forma adecuada."; } } catch (Exception ex) { modalidadPago.mensaje = "ERROR: " + ex.Message; } modalidadPagoResponse.ListaModalidadPago.Add(modalidadPago); } return(modalidadPagoResponse); }
public JsonResult AddModalidadPago(CatModalidadPago modalidadPago, List <CatModalidadPago> listaModalidadPago) { modalidadPago.usuarioInsert = "alan200531"; ModalidadPagoBL modalidadPagoBL = new ModalidadPagoBL(); AddModalidadPagoRequestDTO addModalidadPagoRequest = new AddModalidadPagoRequestDTO(); addModalidadPagoRequest.ListaModalidadPago = new List <CatModalidadPago>(); addModalidadPagoRequest.ListaModalidadPago.Add(modalidadPago); AddModalidadPagoResponseDTO addModalidadPagoResponse = new AddModalidadPagoResponseDTO(); addModalidadPagoResponse = modalidadPagoBL.AddModalidadPago(addModalidadPagoRequest); if (addModalidadPagoResponse.ListaModalidadPago.Count > 0) { modalidadPago.mensaje = addModalidadPagoResponse.ListaModalidadPago[0].mensaje; listaModalidadPago.Add(modalidadPago); } else { modalidadPago.mensaje = "Error: Ocurrio un problema inesperado, no se actualizo correctamente el Plan Empresarial, intenta de nuevo."; } return(Json(listaModalidadPago, JsonRequestBehavior.AllowGet)); }