public void SaveResource(Resource resource)
 {
     if (resource.ResourceId == 0)
     {
         context.SaveChanges();
     }
 }
        public ActionResult Edit(Resource resource)
        {
            if (ModelState.IsValid)
            {
                // save the resource
                repository.SaveResource(resource);
                // add a message to the viewbag
                TempData["message"] = string.Format("{0} has been saved", resource.ResourceName);

                return RedirectToAction("Index");
            }
            else
            {
                // there is something wrong with the data values
                return View(resource);
            }
        }
 public void DeleteResource(Resource resource)
 {
     context.Resources.Remove(resource);
     context.SaveChanges();
 }