Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            detreportegallinas detreportegallinas = db.detreportegallinas.Find(id);

            db.detreportegallinas.Remove(detreportegallinas);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "id,gallinas_id,statusgallina_id,reporte_id")] detreportegallinas detreportegallinas)
 {
     if (ModelState.IsValid)
     {
         db.Entry(detreportegallinas).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.gallinas_id      = new SelectList(db.gallinas, "id", "nombre", detreportegallinas.gallinas_id);
     ViewBag.reporte_id       = new SelectList(db.reporte, "id", "Folio", detreportegallinas.reporte_id);
     ViewBag.statusgallina_id = new SelectList(db.statusgallina, "id", "descripcion", detreportegallinas.statusgallina_id);
     return(View(detreportegallinas));
 }
Beispiel #3
0
        // GET: detreportegallinas/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            detreportegallinas detreportegallinas = db.detreportegallinas.Find(id);

            if (detreportegallinas == null)
            {
                return(HttpNotFound());
            }
            return(View(detreportegallinas));
        }
Beispiel #4
0
        // GET: detreportegallinas/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            detreportegallinas detreportegallinas = db.detreportegallinas.Find(id);

            if (detreportegallinas == null)
            {
                return(HttpNotFound());
            }
            ViewBag.gallinas_id      = new SelectList(db.gallinas, "id", "nombre", detreportegallinas.gallinas_id);
            ViewBag.reporte_id       = new SelectList(db.reporte, "id", "Folio", detreportegallinas.reporte_id);
            ViewBag.statusgallina_id = new SelectList(db.statusgallina, "id", "descripcion", detreportegallinas.statusgallina_id);
            return(View(detreportegallinas));
        }
        public void AgregarDetalleReporte(DetalleReporteVM[] detalleReporte, int reporteid)
        {
            List <detreportegallinas> listaReporte = new List <detreportegallinas>();

            foreach (var item in detalleReporte)
            {
                detreportegallinas detalle = new detreportegallinas();
                detalle.reporte_id       = reporteid;
                detalle.statusgallina_id = db.statusgallina.Where(x => x.descripcion.Equals(item.statusgallina)).FirstOrDefault().id;
                detalle.gallinas_id      = db.gallinas.Where(x => x.nombre.Equals(item.gallina)).FirstOrDefault().id;


                listaReporte.Add(detalle);
            }

            db.detreportegallinas.AddRange(listaReporte);
            db.SaveChanges();
        }