コード例 #1
0
 public ActionResult Edit([Bind(Include = "id,id_user,id_layanan,tanggalpemesanan,tanggaldipesan,biaya,status")] Orders orders)
 {
     if (ModelState.IsValid)
     {
         db.Entry(orders).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.id_layanan = new SelectList(db.Services, "id", "foto", orders.id_layanan);
     ViewBag.id_user    = new SelectList(db.Users, "id", "nama", orders.id_user);
     return(View(orders));
 }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "id,jenis")] Types types)
 {
     if (ModelState.IsValid)
     {
         db.Entry(types).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(types));
 }
コード例 #3
0
        public ActionResult Edit(Services services, HttpPostedFileBase FileUpload)
        {
            if (ModelState.IsValid)
            {
                string file_name = Path.GetFileName(FileUpload.FileName);
                string path      = Path.Combine(Server.MapPath("~/Content/Template/img"), file_name);
                FileUpload.SaveAs(path);

                services.foto = file_name;
                db.Services.Add(services);
                db.Entry(services).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Services"));
            }
            ViewBag.jenis = new SelectList(db.Types, "id", "jenis", services.jenis);
            return(View(services));
        }