public IActionResult numeroPrestamoTipos([FromBody] dynamic value) { try { string filtro_busqueda = value.filtro_busqueda != null ? value.filtro_busqueda : default(string); long total = PrestamoTipoDAO.getTotalPrestamosTipos(filtro_busqueda); return(Ok(new { success = true, totalprestamotipos = total })); } catch (Exception e) { CLogger.write("2", "PrestamoTipoController.class", e); return(BadRequest(500)); } }
public IActionResult PrestamoTipo(int id) { try { bool eliminado = false; PrestamoTipo prestamoTipo = PrestamoTipoDAO.getPrestamoTipoPorId(id); if (prestamoTipo != null) { eliminado = PrestamoTipoDAO.eliminarPrestamoTipo(prestamoTipo); } return(Ok(new { success = eliminado })); } catch (Exception e) { CLogger.write("5", "PrestamoTipoController.class", e); return(BadRequest(500)); } }
public IActionResult PrestamoTipo([FromBody] dynamic value) { try { PrestamoTipoValidator validator = new PrestamoTipoValidator(); ValidationResult results = validator.Validate(value); if (results.IsValid) { PrestamoTipo prestamoTipo = new PrestamoTipo(); prestamoTipo.nombre = value.nombre != null ? (string)value.nombre : default(string); prestamoTipo.descripcion = value.descripcion != null ? (string)value.descripcion : default(string); prestamoTipo.estado = 1; prestamoTipo.usuarioCreo = User.Identity.Name; prestamoTipo.fechaCreacion = DateTime.Now; bool guardado = PrestamoTipoDAO.guardarPrestamoTipo(prestamoTipo); return(Ok(new { success = guardado, id = prestamoTipo.id, usuarioCreo = prestamoTipo.usuarioCreo, fechaCreacion = prestamoTipo.fechaCreacion.ToString("dd/MM/yyyy H:mm:ss"), usuarioActualizo = prestamoTipo.usuarioActualizo, fechaActualizacion = prestamoTipo.fechaActualizacion != null ? prestamoTipo.fechaActualizacion.Value.ToString("dd/MM/yyyy H:mm:ss") : null })); } else { return(Ok(new { success = true })); } } catch (Exception e) { CLogger.write("3", "PrestamoTipoController.class", e); return(BadRequest(500)); } }
public IActionResult PrestamoTipoPagina([FromBody] dynamic value) { try { int pagina = value.pagina != null ? (int)value.pagina : default(int); int numeroprestamostipos = value.numeroprestamostipos != null ? (int)value.numeroprestamostipos : default(int); string filtro_busqueda = value.filtro_busqueda != null ? value.filtro_busqueda : default(string); string columnaOrdenada = value.columnaOrdenada != null ? (string)value.columnaOrdenada : default(string); string ordenDireccion = value.ordenDireccion != null ? (string)value.ordenDireccion : default(string); string excluir = value.excluir != null ? (string)value.excluir : default(string); List <PrestamoTipo> lstprestamotipo = PrestamoTipoDAO.getPrestamosTipoPagina(pagina, numeroprestamostipos, filtro_busqueda, columnaOrdenada, ordenDireccion, excluir); List <stprestamotipo> stprestamostipo = new List <stprestamotipo>(); foreach (PrestamoTipo prestamotipo in lstprestamotipo) { stprestamotipo temp = new stprestamotipo(); temp.id = Convert.ToInt32(prestamotipo.id); temp.nombre = prestamotipo.nombre; temp.descripcion = prestamotipo.descripcion; temp.estado = prestamotipo.estado; temp.fechaActualizacion = prestamotipo.fechaActualizacion != null?prestamotipo.fechaActualizacion.Value.ToString("dd/MM/yyyy H:mm:ss") : null; temp.fechaCreacion = prestamotipo.fechaCreacion.ToString("dd/MM/yyyy H:mm:ss"); temp.usuarioActualizo = prestamotipo.usuarioActualizo; temp.usuarioCreo = prestamotipo.usuarioCreo; stprestamostipo.Add(temp); } return(Ok(new { success = true, prestamostipos = stprestamostipo })); } catch (Exception e) { CLogger.write("1", "PrestamoTipoController.class", e); return(BadRequest(500)); } }