public ActionResult Edit(int id)
 {
     CategoriesDAL c = new CategoriesDAL();
     CategoryDTO dto = new CategoryDTO();
     dto = c.GetCategoryByID(id);
     CategoryModel model = new CategoryModel();
     model.id_categ = dto.id_categ;
     model.categ_name = dto.categ_name;
     return View(model);
 }
 public ActionResult Edit(int id,CategoryModel model)
 {
     CategoriesDAL c = new CategoriesDAL();
     CategoryDTO dto = new CategoryDTO();
     dto = c.GetCategoryByID(id);
     try
     {
         if (ModelState.IsValid)
         {
             dto.categ_name = model.categ_name;
             c.updateCategory(dto);
             return RedirectToAction("Index");
         }
     }
     catch (DataException)
     {
         //Log the error (add a variable name after DataException) 
         ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
     }
     return View(model);
 }