Пример #1
0
        public ActionResult Create(int id)
        {
            CommentAccessory model = new CommentAccessory();

            model.AccessoryId = id;
            return(View(model));
        }
Пример #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            CommentAccessory commentAccessory = db.CommentAccessories.Find(id);

            db.CommentAccessories.Remove(commentAccessory);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #3
0
 public ActionResult Edit([Bind(Include = "CommentId,Name,Opinion,AccessoryId")] CommentAccessory commentAccessory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(commentAccessory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(commentAccessory));
 }
Пример #4
0
        public ActionResult Create(CommentAccessory commentAccessory)
        {
            if (ModelState.IsValid)
            {
                db.CommentAccessories.Add(commentAccessory);
                db.SaveChanges();
                return(RedirectToAction("Index", "Accessories"));
            }

            return(View(commentAccessory));
        }
Пример #5
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CommentAccessory commentAccessory = db.CommentAccessories.Find(id);

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