示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            carrera supp = db.carrera.Find(id);

            db.carrera.Remove(supp);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
        public ActionResult DeleteConfirmed(string id)
        {
            carrera carrera = db.carreras.Find(id);

            db.carreras.Remove(carrera);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#3
0
        void setData()
        {
            carrera Model = controladorCarrera.buscarCarrera(reference);

            Txt_nombre.Text   = Model.nombre_carrera.ToString();
            Txt_jornada.Text  = Model.jornada_carrera.ToString();
            Cbo_facultad.Text = Model.FACULTAD_id_facultad.ToString();
        }
 private void cleanForm()
 {
     FormUtils.clearTextbox(textControls());
     rdbActivo.Checked   = true;
     rdbInactivo.Checked = false;
     btnAgregar.Text     = "Agregar";
     selectedCarrera     = null;
     errorProvider1.Clear();
 }
示例#5
0
        public ActionResult Delete(int id)
        {
            carrera supp = db.carrera.Find(id);

            if (supp == null)
            {
                return(HttpNotFound());
            }
            return(View(supp));
        }
示例#6
0
 public ActionResult Edit(carrera supp)
 {
     if (ModelState.IsValid)
     {
         db.Entry(supp).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(supp));
 }
示例#7
0
        public ActionResult Edit(int id)
        {
            carrera supp = db.carrera.Single(x => x.id == id);

            if (supp == null)
            {
                return(HttpNotFound());
            }
            return(View(supp));
        }
示例#8
0
 public ActionResult Create(carrera supp)
 {
     if (ModelState.IsValid)
     {
         db.carrera.Add(supp);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View());
 }
示例#9
0
 public ActionResult Edit([Bind(Include = "idCarrera,nombreCarrera")] carrera carrera)
 {
     if (ModelState.IsValid)
     {
         db.Entry(carrera).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(carrera));
 }
示例#10
0
 public ActionResult Edit([Bind(Include = "cod_carrera,nombre,tipo_carrera,modalidad,cod_dpto")] carrera carrera)
 {
     if (ModelState.IsValid)
     {
         db.Entry(carrera).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.cod_dpto = new SelectList(db.dptoes, "cod_dpto", "nombre", carrera.cod_dpto);
     return(View(carrera));
 }
示例#11
0
 public ActionResult Edit([Bind(Include = "codigoCarrera,codigoArea,nombreCarrea")] carrera carrera)
 {
     if (ModelState.IsValid)
     {
         db.Entry(carrera).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.codigoArea = new SelectList(db.area, "codigoArea", "nombreArea", carrera.codigoArea);
     return(View(carrera));
 }
示例#12
0
        public ActionResult Create([Bind(Include = "idCarrera,nombreCarrera")] carrera carrera)
        {
            if (ModelState.IsValid)
            {
                db.carreras.Add(carrera);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(carrera));
        }
示例#13
0
        public ActionResult Create([Bind(Include = "cod_carrera,nombre,tipo_carrera,modalidad,cod_dpto")] carrera carrera)
        {
            if (ModelState.IsValid)
            {
                db.carreras.Add(carrera);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.cod_dpto = new SelectList(db.dptoes, "cod_dpto", "nombre", carrera.cod_dpto);
            return(View(carrera));
        }
    public ActionResult <carrera> Put([FromBody] carrera carrera, [FromHeader] string token)
    {
        if (UsuarioConexion <usuario> .Instance.getUserToken(token))
        {
            CarreraConexion <carrera> .Instance.Update(carrera);

            return(Json("El proceso de almacenado se realizó con éxito."));
        }
        else
        {
            return(null);
        }
    }
示例#15
0
        // GET: carreras/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            carrera carrera = db.carreras.Find(id);

            if (carrera == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(carrera));
        }
 private void fillSelectedData(carrera currentCarr)
 {
     txtNombre.Text             = currentCarr.nombre;
     cmbFacultades.SelectedItem = currentCarr.facultad;
     cmbTipos.SelectedItem      = currentCarr.tipo_carrera;
     if (currentCarr.estado)
     {
         rdbActivo.Checked = true;
     }
     else
     {
         rdbInactivo.Checked = true;
     }
 }
示例#17
0
        // GET: carreras/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            carrera carrera = db.carreras.Find(id);

            if (carrera == null)
            {
                return(HttpNotFound());
            }
            return(View(carrera));
        }
示例#18
0
        // GET: carreras/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            carrera carrera = db.carreras.Find(id);

            if (carrera == null)
            {
                return(HttpNotFound());
            }
            ViewBag.cod_dpto = new SelectList(db.dptoes, "cod_dpto", "nombre", carrera.cod_dpto);
            return(PartialView(carrera));
        }
示例#19
0
        // GET: carreras/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            carrera carrera = db.carrera.Find(id);

            if (carrera == null)
            {
                return(HttpNotFound());
            }
            ViewBag.codigoArea = new SelectList(db.area, "codigoArea", "nombreArea", carrera.codigoArea);
            return(View(carrera));
        }
示例#20
0
        //Metodo para guardar una nueva carrera
        public void guardarCarrera(String nombre_carrera, int FACULTAD_id_facultad, String jornada_carrera)
        {
            ModelAsignacion db = new ModelAsignacion();

            carrera carreraNueva = new carrera();


            carreraNueva.nombre_carrera       = nombre_carrera;
            carreraNueva.FACULTAD_id_facultad = FACULTAD_id_facultad;
            carreraNueva.jornada_carrera      = jornada_carrera;


            db.carrera.Add(carreraNueva);
            db.SaveChanges();
        }
 private void DgvCarreras_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         int index = e.RowIndex;
         if (index >= 0)
         {
             selectedCarrera = carreras[index];
             btnAgregar.Text = "Modificar";
             fillSelectedData(selectedCarrera);
         }
     }
     catch (Exception ex)
     {
         FormUtils.defaultErrorMessage(ex);
     }
 }
示例#22
0
        public void InsertWithoutData(curso prod, carrera sup)
        {
            using (db)
            {
                //add instances to context
                db.curso.Add(prod);
                db.carrera.Add(sup);

                //add instance that relates to another entity
                // in this case prod is an instance of Product entity
                // Product has a property call Supplier
                prod.carrera.Add(sup);

                //call SaveChanges from context to confirm inserts
                db.SaveChanges();
            }
        }
        private void saveData()
        {
            carrera tempCarr = new carrera
            {
                nombre     = txtNombre.Text,
                idFacultad = ((facultad)cmbFacultades.SelectedValue).id,
                idTipo     = ((tipo_carrera)cmbTipos.SelectedValue).id,
                estado     = rdbActivo.Checked
            };
            Operation <carrera> operation = carreraController.addRecord(tempCarr);

            if (operation.State)
            {
                MessageBox.Show("Carrera agregada con éxito", "Éxito",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                loadTable();
                cleanForm();
            }
        }
        public ActionResult Create(carrera insertcarrera)
        {
            HttpClient hc = new HttpClient();

            hc.BaseAddress = new Uri("https://localhost:44316/api/CarreraCrud");

            var insertrecord = hc.PostAsJsonAsync <carrera>("CarreraCrud", insertcarrera);

            insertrecord.Wait();

            var guardardata = insertrecord.Result;

            if (guardardata.IsSuccessStatusCode)
            {
                return(RedirectToAction("ListadoCarreras"));
            }

            return(View("Create"));
        }
        private void updateData(carrera currentCarr)
        {
            currentCarr.nombre     = txtNombre.Text;
            currentCarr.idFacultad = ((facultad)cmbFacultades.SelectedValue).id;
            currentCarr.idTipo     = ((tipo_carrera)cmbTipos.SelectedValue).id;
            currentCarr.estado     = rdbActivo.Checked;

            Operation <carrera> operation = carreraController.updateRecord(currentCarr);

            if (operation.State)
            {
                MessageBox.Show("Carrera actualizada con éxito", "Éxito",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                loadTable();
                cleanForm();
            }
            else
            {
                MessageBox.Show(operation.Error, "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#26
0
        public void InsertWithData(int productID, int supplierID)
        {
            using (db)
            {
                /*
                 * this steps have to follow to both entities
                 *
                 * 1 - create instance of entity with relative primary key
                 *
                 * 2 - add instance to context
                 *
                 * 3 - attach instance to context
                 */

                // 1
                curso p = new curso {
                    id = productID
                };
                // 2
                db.curso.Add(p);
                // 3
                db.curso.Attach(p);

                // 1
                carrera s = new carrera {
                    id = supplierID
                };
                // 2
                db.carrera.Add(s);
                // 3
                db.carrera.Attach(s);

                // like previous method add instance that relates to another entity
                p.carrera.Add(s);

                // call SaveChanges
                db.SaveChanges();
            }
        }
 public IHttpActionResult Insertcarrera(carrera insertcarrera)
 {
     uniwebsite.carreras.Add(insertcarrera);
     uniwebsite.SaveChanges();
     return(Ok());
 }