Created
December 5, 2008 04:42
-
-
Save anonymous/32237 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AdminController < ApplicationController | |
layout 'admin' | |
def index | |
end | |
#----------------PACIENTES ----------------------- | |
def crear_paciente | |
if request.post? # aca es para que no haga lo mismo con el get sino solo con el POST | |
@paciente = Paciente.new(params[:paciente]) | |
if @paciente.save | |
flash[:notice] = 'guardado jijiij' | |
redirect_to :action => 'mostrar_paciente' | |
end | |
end | |
end | |
def editar_paciente | |
@paciente = Paciente.find(params[:id]) | |
if request.post? | |
if @paciente.update_attributes(params[:paciente]) | |
flash[:notice] = 'El paciente fue actualizada' | |
redirect_to :action => 'mostrar_paciente' | |
end | |
end | |
end | |
def mostrar_paciente | |
@paciente = Paciente.find(:all, :limit =>10 ,:order => "id DESC") | |
end | |
def borrar_paciente | |
@paciente = Paciente.find(params[:id]) | |
@paciente.destroy | |
redirect_to :action => "mostrar_paciente" | |
flash[:notice]="Paciente borrado" | |
end | |
#----------------CATEGORIAS DE EXAMENES ----------------------- | |
def crear_categoria | |
if request.post? | |
@categoria = CategoriaExamen.new(params[:categoria_examen]) | |
if @categoria.save | |
flash[:notice] = 'guardado jijiij' | |
redirect_to :action => 'mostrar_categoria' | |
end | |
end | |
end | |
def editar_categoria | |
@categoria = CategoriaExamen.find(params[:id]) | |
if request.post? | |
if @categoria.update_attributes(params[:categoria]) | |
flash[:notice] = 'La categoria fue actualizada' | |
redirect_to :action => 'mostrar_categoria' | |
end | |
end | |
end | |
def mostrar_categoria | |
@categoria = CategoriaExamen.find(:all, :limit =>10 ,:order => "id DESC") | |
end | |
def borrar_categoria | |
@categoria = CategoriaExamen.find(params[:id]) | |
@categoria.destroy | |
redirect_to :action => "mostrar_categoria" | |
flash[:notice]="categoria borrada" | |
end | |
#----------------EXAMENES----------------------- | |
def crear_examen | |
if request.post? | |
@examen = Examen.new(params[:examen]) | |
if @examen.save | |
flash[:notice] = 'guardado jijiij' | |
redirect_to :action => 'mostrar_examen' | |
end | |
end | |
end | |
def editar_examen | |
@examen = Examen.find(params[:id]) | |
if request.post? | |
if @examen.update_attributes(params[:examen]) | |
flash[:notice] = 'El examen fue actualizado' | |
redirect_to :action => 'mostrar_examen' | |
end | |
end | |
end | |
def mostrar_examen | |
@examen = Examen.find(:all, :limit =>10 ,:order => "id DESC") | |
end | |
def borrar_examen | |
@categoria = Examen.find(params[:id]) | |
@categoria.destroy | |
redirect_to :action => "mostrar_examen" | |
flash[:notice]="examen borrad0" | |
end | |
def ver_examen | |
@examen = Examen.find(params[:id]) | |
end | |
#----------------RESULTADOS ----------------------- | |
auto_complete_for :paciente, :nombre | |
def crear_resultado | |
if request.post? | |
@resultado = Resutado.new(params[:resultadof]) | |
if @resultado.save | |
flash[:notice] = 'guardado jijiij' | |
redirect_to :action => 'mostrar_resultado' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment