Exemple #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Category category;

            using (Repos repo = new Repos())
            {
                category = repo.GetCategoryByID(id);
                repo.DeleteCategory(category.CategoryID);
            }
            return(RedirectToAction("Index"));
        }
Exemple #2
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            int      ID = id ?? 0;
            Category category;

            using (Repos repo = new Repos())
            {
                category = repo.GetCategoryByID(ID);
            }
            if (category == null)
            {
                return(HttpNotFound());
            }
            return(View(category));
        }