Пример #1
0
        public ActionResult Create(Pattern pattern)
        {
            //Check if model is valid, then add Pattern to table and save changes to Database
            if (ModelState.IsValid)
            {
                db.Patterns.Add(pattern);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(pattern);
        }
Пример #2
0
 public ActionResult Edit(Pattern pattern)
 {
     //Check if model is valid, then edit Materials to table and save changes to Pattern
     if (ModelState.IsValid)
     {
         db.Entry(pattern).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(pattern);
 }