예제 #1
0
        public ActionResult Create(Garment garment)
        {
            //Check if model is valid, then add Garment to table and save changes to Database
            if (ModelState.IsValid)
            {
                db.Garments.Add(garment);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(garment);
        }
예제 #2
0
 public ActionResult Edit(Garment garment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(garment).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(garment);
 }