public async Task<ActionResult> EditorPago(int id = 0) { try { var datosSesion = SesionModel.DatosSesion; //Invocamos al servicio var response = await _ServicioMiDepa.ObtenerEditorPagoAsync(Convert.ToInt32(datosSesion.Usuario.CodigoEdificio), id); //Construimos el modelo var model = new PagoEditorViewModel(response); //Retornamos vista con modelo return PartialView("_EditorPago", model); } catch (Exception) { throw; } }
public async Task <ActionResult> EditorRO(int id) { try { //Construimos el modelo var sesionUsuario = SesionModel.DatosSesion.Usuario; var response = await _ServicioMiDepa.ObtenerEditorPagoAsync((int)sesionUsuario.CodigoEdificio, id); var model = new PagoEditorViewModel(response); //Retornamos vista con modelo return(PartialView("_EditorPagoRO", model)); } catch (FaultException <ServiceErrorResponseType> ex) { //Como existe excepción de lógica de negocio, lo enviamos al Vehiculo para ser procesado por este return(Json(HelperJson.ConstruirJson(EnumTipoNotificacion.Advertencia, ex.Detail.Message), JsonRequestBehavior.AllowGet)); } }
public async Task<ActionResult> Modificar(PagoEditorViewModel model) { try { //Construimos el request var request = new PagoRequestDto { Pago = model.Pago }; //Invocamos al servicio await _ServicioMiDepa.ActualizarPagoAsync(request); //Refrescamos la pagina con los registros actuales return Json("OK"); } catch (FaultException<ServiceErrorResponseType> ex) { //Como existe excepción de lógica de negocio, lo enviamos al Vehiculo para ser procesado por este return Json(HelperJson.ConstruirJson(EnumTipoNotificacion.Advertencia, ex.Detail.Message), JsonRequestBehavior.AllowGet); } }
public async Task<ActionResult> Agregar(PagoEditorViewModel model) { try { var tabla = Constantes.Tablas.PAGO; var request = new PagoRequestDto { Pago = model.Pago }; if (model.Adjunto1 != null) { Stream str = model.Adjunto1.InputStream; BinaryReader Br = new BinaryReader(str); Byte[] foto = Br.ReadBytes((Int32)str.Length); request.Adjunto1 = new Archivo { BinData = foto, Extension = model.Adjunto1.ContentType, Nombre = model.Adjunto1.FileName, Tabla = tabla }; } if (model.Adjunto2 != null) { Stream str = model.Adjunto2.InputStream; BinaryReader Br = new BinaryReader(str); Byte[] foto = Br.ReadBytes((Int32)str.Length); request.Adjunto2 = new Archivo { BinData = foto, Extension = model.Adjunto2.ContentType, Nombre = model.Adjunto2.FileName, Tabla = tabla }; } if (model.Adjunto3 != null) { Stream str = model.Adjunto3.InputStream; BinaryReader Br = new BinaryReader(str); Byte[] foto = Br.ReadBytes((Int32)str.Length); request.Adjunto3 = new Archivo { BinData = foto, Extension = model.Adjunto3.ContentType, Nombre = model.Adjunto3.FileName, Tabla = tabla }; } //Invocamos al servicio await _ServicioMiDepa.InsertarPagoAsync(request); //Refrescamos la pagina con los registros actuales return Json("OK"); } catch (FaultException<ServiceErrorResponseType> ex) { //Como existe excepción de lógica de negocio, lo enviamos al Vehiculo para ser procesado por este return Json(HelperJson.ConstruirJson(EnumTipoNotificacion.Advertencia, ex.Detail.Message), JsonRequestBehavior.AllowGet); } }