public ActionResult Confirm([Bind(Include = "ClothesID,ClothingType,ClothingAmount,Size,Status")] IncomingClothes incomingClothes,
                                    [Bind(Include = "ClothesID,ClothingType,ClothingAmount,Size")] Clothes clothes)
        {
            if (ModelState.IsValid)
            {
                var cloth = (from c in db.Clothes
                             where c.ClothingType == incomingClothes.ClothingType && c.Size == incomingClothes.Size
                             select new { c.ClothingAmount, c.ClothingType, c.Size, c.ClothesID }).SingleOrDefault();

                if (cloth != null)
                {
                    clothes = db.Clothes.Find(cloth.ClothesID);
                    clothes.ClothingAmount          = cloth.ClothingAmount + incomingClothes.ClothingAmount;
                    db.Entry(clothes).State         = EntityState.Modified;
                    db.Entry(incomingClothes).State = EntityState.Modified;
                    incomingClothes.Status          = "Accepted";
                }
                else
                {
                    db.Entry(incomingClothes).State = EntityState.Modified;
                    incomingClothes.Status          = "Accepted";
                    db.Clothes.Add(clothes);
                }
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(incomingClothes));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            IncomingClothes incomingClothes = db.IncomingClothes.Find(id);

            db.IncomingClothes.Remove(incomingClothes);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ClothesID,ClothingType,ClothingAmount,Size,Status")] IncomingClothes incomingClothes)
 {
     if (ModelState.IsValid)
     {
         db.Entry(incomingClothes).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(incomingClothes));
 }
        public ActionResult Create([Bind(Include = "ClothesID,ClothingType,ClothingAmount,Size,Status")] IncomingClothes incomingClothes)
        {
            if (ModelState.IsValid)
            {
                incomingClothes.Status = "Not Arrived";
                db.IncomingClothes.Add(incomingClothes);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(incomingClothes));
        }
        // GET: IncomingClothes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            IncomingClothes incomingClothes = db.IncomingClothes.Find(id);

            if (incomingClothes == null)
            {
                return(HttpNotFound());
            }
            return(View(incomingClothes));
        }