// 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()); }
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)); }
public IHttpActionResult Put(Voluntario voluntario) { try { VoluntarioBLL.Update(voluntario); return(Content(HttpStatusCode.OK, "Voluntario actualizado correctamente")); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IHttpActionResult Post(Voluntario voluntario) { try { VoluntarioBLL.Create(voluntario); return(Content(HttpStatusCode.Created, "Voluntario creado correctamente")); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IHttpActionResult Delete(int id) { try { VoluntarioBLL.Delete(id); return(Ok("Voluntario eliminado correctamente")); } catch (Exception ex) { return(Content(HttpStatusCode.BadRequest, ex)); } }
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)); }
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)); } }
// 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)); }
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)); } }
// 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)); }
// private Entities db = new Entities(); // GET: Voluntarios public ActionResult Index() { return(View(VoluntarioBLL.List())); }
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())); }