public async Task <ActionResult <Jurado> > PostJurado(Jurado jurado) { _context.Jurado.Add(jurado); await _context.SaveChangesAsync(); return(CreatedAtAction("GetJurado", new { id = jurado.UsuarioID }, jurado)); }
public ActionResult CreateJurado([Bind(Include = "ID,nombre")] Jurado jurado, HttpPostedFileBase upload) { try { Jurado jura = new Jurado(); jura.nombre = jurado.nombre; db.Juradoes.Add(jura); db.SaveChanges(); PersonaXJurado personaJurado = new PersonaXJurado(); personaJurado.id_persona = Int32.Parse(Session["ID"].ToString()); personaJurado.id_jurado = jurado.ID; db.PersonaXJuradoes.Add(personaJurado); db.SaveChanges(); if (upload != null) { upload.SaveAs(Path.Combine(Server.MapPath("~/App_Data/uploads"), upload.FileName)); string fullPath = Path.Combine(Server.MapPath("~/App_Data/uploads"), upload.FileName); InsertJuraDoc(System.Guid.NewGuid(), System.IO.Path.GetFileName(upload.FileName), fullPath, jura.ID); //Path.GetFllPath(upload.FileName); } ViewBag.jurAgregad = jurado.nombre; return(View(jurado)); } catch (Exception e) { ViewBag.errorjura = "Error : No se pudo agregar el jurado "; return(View()); } }
public async Task <IActionResult> PutJurado(int id, Jurado jurado) { if (id != jurado.UsuarioID) { return(BadRequest()); } _context.Entry(jurado).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!JuradoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public MainPage() { InitializeComponent(); btnObter.Clicked += btnObter_Clicked; ClienteRest cliente = new ClienteRest(); string resultado = string.Empty; try { resultado = cliente.obterDados(URL_GET); } catch (Exception) { lblWelcome.Text = erroDefaul; throw new Exception(erroDefaul); } juri = JsonConvert.DeserializeObject <List <Jurado> >(resultado); Jurado jurado = juri.Take(1).FirstOrDefault <Jurado>(); foreach (Jurado juradoAtual in juri) { cmbJuri.Items.Add(juradoAtual.ToString()); } }
public async Task <IActionResult> Edit(int id, [Bind("UsuarioID,CI,Nombres,Apellidos,Usuario,Password,FechaNacimiento,MesaID")] Jurado jurado) { if (id != jurado.UsuarioID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(jurado); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!JuradoExists(jurado.UsuarioID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["MesaID"] = new SelectList(_context.Set <Mesa>(), "MesaID", "CodigoQR", jurado.MesaID); return(View(jurado)); }
public ActionResult DeleteConfirmed(int id) { Jurado jurado = db.Juradoes.Find(id); db.Juradoes.Remove(jurado); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,nombre")] Jurado jurado) { if (ModelState.IsValid) { db.Entry(jurado).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(jurado)); }
public async Task <IActionResult> Create([Bind("UsuarioID,CI,Nombres,Apellidos,Usuario,Password,FechaNacimiento,MesaID")] Jurado jurado) { if (ModelState.IsValid) { _context.Add(jurado); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["MesaID"] = new SelectList(_context.Set <Mesa>(), "MesaID", "CodigoQR", jurado.MesaID); return(View(jurado)); }
public ListaJuri() { InitializeComponent(); JuradoBo bo = new JuradoBo(); Jurado j = new Jurado(); IList <Festival.or.Jurado> lista = bo.Listar(); gridControl.RefreshDataSource(); this.bindingSource.Clear(); bindingSource.DataSource = lista; this.bindingSource.ResetBindings(true); gridControl.Refresh(); }
// GET: Jurado/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Jurado jurado = db.Juradoes.Find(id); if (jurado == null) { return(HttpNotFound()); } return(View(jurado)); }
private void btnObter_Clicked(object sender, EventArgs e) { ClienteRest cliente = new ClienteRest(); string resultado = string.Empty; try { resultado = cliente.obterDados(URL_GET); } catch (Exception) { lblWelcome.Text = erroDefaul; throw new Exception(erroDefaul); } juri = JsonConvert.DeserializeObject <List <Jurado> >(resultado); Jurado jurado = juri.Take(1).FirstOrDefault <Jurado>(); lblWelcome.Text = jurado.nome; }