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

            db.OutgoingClothes.Remove(outgoingClothes);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "ClothesID,ClothingType,ClothingAmount,Size")] OutgoingClothes outgoingClothes)
 {
     if (ModelState.IsValid)
     {
         db.Entry(outgoingClothes).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(outgoingClothes));
 }
コード例 #3
0
        public ActionResult Create([Bind(Include = "ClothesID,ClothingType,ClothingAmount,Size")] OutgoingClothes outgoingClothes)
        {
            if (ModelState.IsValid)
            {
                db.OutgoingClothes.Add(outgoingClothes);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(outgoingClothes));
        }
コード例 #4
0
        // GET: OutgoingClothes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OutgoingClothes outgoingClothes = db.OutgoingClothes.Find(id);

            if (outgoingClothes == null)
            {
                return(HttpNotFound());
            }
            return(View(outgoingClothes));
        }
コード例 #5
0
        public ActionResult OutGoing([Bind(Include = "ClothesID,ClothingType,ClothingAmount,Size")] Clothes clothes, OutgoingClothes outclothes)
        {
            var query = (from c in db.Clothes
                         where c.ClothesID == clothes.ClothesID
                         select new { c.ClothingAmount }).Single();
            double check = query.ClothingAmount;

            if (ModelState.IsValid)
            {
                db.OutgoingClothes.Add(outclothes);
                clothes.ClothingAmount  = check - clothes.ClothingAmount;
                db.Entry(clothes).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }

            return(View(clothes));
        }