public async Task <ActionResult <Jurado> > PostJurado(Jurado jurado)
        {
            _context.Jurado.Add(jurado);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetJurado", new { id = jurado.UsuarioID }, jurado));
        }
Beispiel #2
0
        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());
        }
Beispiel #4
0
        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());
            }
        }
Beispiel #5
0
        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));
        }
Beispiel #6
0
        public ActionResult DeleteConfirmed(int id)
        {
            Jurado jurado = db.Juradoes.Find(id);

            db.Juradoes.Remove(jurado);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #7
0
 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));
 }
Beispiel #8
0
        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();
        }
Beispiel #10
0
        // 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));
        }
Beispiel #11
0
        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;
        }