Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            UnCategories category = categoryManager.Find(x => x.Id == id);

            categoryManager.Delete(category);
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public ActionResult Create(UnCategories category)
        {
            ModelState.Remove("UpdatedDate");
            ModelState.Remove("CreatedDate");
            ModelState.Remove("UpdatedUserName");
            if (ModelState.IsValid)
            {
                categoryManager.Insert(category);

                return(RedirectToAction("Index"));
            }

            return(View(category));
        }
Esempio n. 3
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            UnCategories category = categoryManager.Find(x => x.Id == id.Value);

            if (category == null)
            {
                return(HttpNotFound());
            }
            return(View(category));
        }
Esempio n. 4
0
        public ActionResult SelectDepartment(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            UnCategories cat = categoryManager.Find(x => x.Id == id.Value);

            if (cat == null)
            {
                return(HttpNotFound());
            }
            return(View("DepartmentId", cat.Hashtags));
        }
Esempio n. 5
0
        public ActionResult Edit(UnCategories category)
        {
            ModelState.Remove("UpdatedDate");
            ModelState.Remove("CreatedDate");
            ModelState.Remove("UpdatedUserName");
            if (ModelState.IsValid)
            {
                UnCategories cat = categoryManager.Find(x => x.Id == category.Id);
                cat.Name        = category.Name;
                cat.Description = category.Description;

                categoryManager.Update(cat);

                return(RedirectToAction("Index"));
            }
            return(View(category));
        }