コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Cloths cloths = db.cloths.Find(id);

            db.cloths.Remove(cloths);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "ID,cloth_Type,clothCode,cloth_image")] Cloths cloths)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cloths).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cloths));
 }
コード例 #3
0
        // GET: Cloths/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Cloths cloths = db.cloths.Find(id);

            if (cloths == null)
            {
                return(HttpNotFound());
            }
            return(View(cloths));
        }
コード例 #4
0
        public ActionResult Create([Bind(Include = "ID,cloth_Type,clothCode,cloth_image")] Cloths cloths, HttpPostedFileBase filelist)
        {
            if (ModelState.IsValid)
            {
                if (filelist != null && filelist.ContentLength > 0)
                {
                    cloths.cloth_image = ConvertToBytes(filelist);
                }


                db.cloths.Add(cloths);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(cloths));
        }