Exemple #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            categoryModels categoryModels = db.categoryData.Find(id);

            db.categoryData.Remove(categoryModels);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
 public ActionResult Edit([Bind(Include = "Id,categoryType,categoryDiscription")] categoryModels categoryModels)
 {
     if (ModelState.IsValid)
     {
         db.Entry(categoryModels).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(categoryModels));
 }
Exemple #3
0
        public ActionResult Create([Bind(Include = "Id,categoryType,categoryDiscription,productType")] categoryModels categoryModels)
        {
            if (ModelState.IsValid)
            {
                db.categoryData.Add(categoryModels);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(categoryModels));
        }
Exemple #4
0
        // GET: category/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            categoryModels categoryModels = db.categoryData.Find(id);

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