Example #1
0
 // GET: Registros/Create
 public ActionResult Create()
 {
     ViewBag.idaporte     = new SelectList(AporteBLL.List(), "idaporte", "descripcion");
     ViewBag.idevento     = new SelectList(EventoBLL.ListToNames(), "idevento", "nombre");
     ViewBag.idvoluntario = new SelectList(VoluntarioBLL.ListToNames(), "idvoluntario", "nombres");
     return(View());
 }
Example #2
0
 public ActionResult Edit([Bind(Include = "idvoluntario,nombres,apellidos,cedula,telefono,fecha_nacimiento,direccion,sexo")] Voluntario voluntario)
 {
     if (ModelState.IsValid)
     {
         VoluntarioBLL.Update(voluntario);
         return(RedirectToAction("Index"));
     }
     return(View(voluntario));
 }
Example #3
0
 public IHttpActionResult Put(Voluntario voluntario)
 {
     try
     {
         VoluntarioBLL.Update(voluntario);
         return(Content(HttpStatusCode.OK, "Voluntario actualizado correctamente"));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Example #4
0
 public IHttpActionResult Post(Voluntario voluntario)
 {
     try
     {
         VoluntarioBLL.Create(voluntario);
         return(Content(HttpStatusCode.Created, "Voluntario creado correctamente"));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Example #5
0
 public IHttpActionResult Delete(int id)
 {
     try
     {
         VoluntarioBLL.Delete(id);
         return(Ok("Voluntario eliminado correctamente"));
     }
     catch (Exception ex)
     {
         return(Content(HttpStatusCode.BadRequest, ex));
     }
 }
Example #6
0
 public ActionResult Edit([Bind(Include = "idregistro,idvoluntario,idevento,idaporte")] Registro registro)
 {
     if (ModelState.IsValid)
     {
         RegistroBLL.Update(registro);
         return(RedirectToAction("Index"));
     }
     ViewBag.idaporte     = new SelectList(AporteBLL.List(), "idaporte", "descripcion", registro.idaporte);
     ViewBag.idevento     = new SelectList(EventoBLL.ListToNames(), "idevento", "nombre", registro.idevento);
     ViewBag.idvoluntario = new SelectList(VoluntarioBLL.ListToNames(), "idvoluntario", "nombres", registro.idvoluntario);
     return(View(registro));
 }
Example #7
0
 public IHttpActionResult Get()
 {
     try
     {
         List <Voluntario> todos = VoluntarioBLL.List();
         return(Content(HttpStatusCode.OK, todos));
         //return Json(todos);
     }
     catch (Exception ex)
     {
         return(Content(HttpStatusCode.BadRequest, ex));
     }
 }
Example #8
0
        // GET: Voluntarios/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Voluntario voluntario = VoluntarioBLL.Get(id);

            if (voluntario == null)
            {
                return(HttpNotFound());
            }
            return(View(voluntario));
        }
Example #9
0
 public IHttpActionResult Get(int id)
 {
     try
     {
         Voluntario result = VoluntarioBLL.Get(id);
         if (result == null)
         {
             return(NotFound());
         }
         return(Content(HttpStatusCode.OK, result));
     }
     catch (Exception ex)
     {
         return(Content(HttpStatusCode.BadRequest, ex));
     }
 }
Example #10
0
        // GET: Registros/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Registro registro = RegistroBLL.Get(id);

            if (registro == null)
            {
                return(HttpNotFound());
            }
            ViewBag.idaporte     = new SelectList(AporteBLL.List(), "idaporte", "descripcion", registro.idaporte);
            ViewBag.idevento     = new SelectList(EventoBLL.ListToNames(), "idevento", "nombre", registro.idevento);
            ViewBag.idvoluntario = new SelectList(VoluntarioBLL.ListToNames(), "idvoluntario", "nombres", registro.idvoluntario);
            return(View(registro));
        }
Example #11
0
        //  private Entities db = new Entities();

        // GET: Voluntarios
        public ActionResult Index()
        {
            return(View(VoluntarioBLL.List()));
        }
Example #12
0
 public ActionResult DeleteConfirmed(int id)
 {
     VoluntarioBLL.Delete(id);
     return(RedirectToAction("Index"));
 }
        //private Entities db = new Entities();

        // GET: Voluntarios
        public ActionResult Index()
        {
            ViewBag.Title = "Listado de Voluntarios registrados";
            return(View(VoluntarioBLL.List()));
        }