예제 #1
0
        public ActionResult Edit([Bind(Include = "Id,Name,Processor,Motherboard,Ram,Hard_drive,Delivery,Order,image")] Komputers komputers, HttpPostedFileBase upload)
        {
            if (ModelState.IsValid)
            {
                db.Entry(komputers).State = EntityState.Modified;
                if (upload != null && upload.ContentLength > 0)
                {
                    using (var reader = new System.IO.BinaryReader(upload.InputStream))
                    {
                        komputers.image = reader.ReadBytes(upload.ContentLength);
                    }
                    db.SaveChanges();
                }

                else
                {
                    db.Entry(komputers).Property(m => m.image).IsModified = false;
                    db.SaveChanges();
                }

                db.SaveChanges();
                return(RedirectToAction("admin_index"));
            }
            ViewBag.Delivery    = new SelectList(db.Deliveries, "id", "date", komputers.Delivery);
            ViewBag.Hard_drive  = new SelectList(db.Hard_disks, "Id", "Name", komputers.Hard_drive);
            ViewBag.Motherboard = new SelectList(db.Motherboards, "Id", "Name", komputers.Motherboard);
            ViewBag.Order       = new SelectList(db.Orders, "id", "date", komputers.Order);
            ViewBag.Processor   = new SelectList(db.Processors, "Id", "Name", komputers.Processor);
            ViewBag.Ram         = new SelectList(db.Rams, "Id", "Name", komputers.Ram);
            return(View(komputers));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "Id,DescricaoTipo,DataCadastro")] TipoDocumento tipoDocumento)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tipoDocumento).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tipoDocumento));
 }
예제 #3
0
 public ActionResult Edit([Bind(Include = "Id,Date,Num_Delivery")] Deliveries deliveries)
 {
     if (ModelState.IsValid)
     {
         db.Entry(deliveries).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(deliveries));
 }
예제 #4
0
 public ActionResult Edit([Bind(Include = "Id,Login,Password")] Admin admin)
 {
     if (ModelState.IsValid)
     {
         db.Entry(admin).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(admin));
 }
예제 #5
0
 public ActionResult Edit([Bind(Include = "Id,yardName")] yard yard)
 {
     if (ModelState.IsValid)
     {
         db.Entry(yard).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(yard));
 }
예제 #6
0
 public ActionResult Edit(int id, Cources cource)
 {
     if (ModelState.IsValid)
     {
         _db.Entry(cource).State = EntityState.Modified;
         _db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cource));
 }
예제 #7
0
 public ActionResult Edit([Bind(Include = "Id,location_name,longitude,latitude")] Place place)
 {
     if (ModelState.IsValid)
     {
         db.Entry(place).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(place));
 }
예제 #8
0
 public ActionResult Edit([Bind(Include = "Id,ConName")] container container)
 {
     if (ModelState.IsValid)
     {
         db.Entry(container).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(container));
 }
예제 #9
0
 public ActionResult Edit([Bind(Include = "Id,time,date,depart,arrive")] schedule schedule)
 {
     if (ModelState.IsValid)
     {
         db.Entry(schedule).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(schedule);
 }
예제 #10
0
 public ActionResult Edit([Bind(Include = "Id,Name,Price,Delivery,Order,Maker")] Motherboards motherboards)
 {
     if (ModelState.IsValid)
     {
         db.Entry(motherboards).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Delivery = new SelectList(db.Deliveries, "Id", "date", motherboards.Delivery);
     ViewBag.Maker    = new SelectList(db.Makers, "Id", "Name", motherboards.Maker);
     ViewBag.Order    = new SelectList(db.Orders, "Id", "date", motherboards.Order);
     return(View(motherboards));
 }