public void CreateCategoryType(CategoryType categorytype)
        {
            CategoryType newcategory = categorytype;

            dbcontex.CategoryTypes.Add(categorytype);
            dbcontex.SaveChanges();
        }
        public void SaveEditedCategoryType(CategoryType categorytype)
        {
            CategoryType newcategorytype = FindCategoryType(categorytype.Id);

            newcategorytype.Title = categorytype.Title;
            newcategorytype.Description = categorytype.Description;

            dbcontex.Entry(newcategorytype).State = EntityState.Modified;
            dbcontex.SaveChanges();
        }
Esempio n. 3
0
 public ActionResult CreateCategoryType(CategoryType categorytype)
 {
     repository.CreateCategoryType(categorytype);
     // перенаправляем на главную страницу
     return RedirectToAction("CategoryTypesList");
 }
Esempio n. 4
0
 public ActionResult CreateCategoryType()
 {
     CategoryType newitem = new CategoryType();
     return PartialView("PartialCreateCategoryType", newitem);
 }
Esempio n. 5
0
 public ActionResult EditCategoryType(CategoryType categorytype)
 {
     repository.SaveEditedCategoryType(categorytype);
     return RedirectToAction("CategoryTypesList");
 }
 public void DeleteCategoryType(CategoryType categorytype)
 {
     dbcontex.CategoryTypes.Remove(categorytype);
     dbcontex.SaveChanges();
 }