//creating an instance of volunteer table (Model) as a parameter
 public bool commitInsert(volunteer vol)
 {
     //to ensure all data will be disposed of when finished
     using (objVol)
     {
         //using our model to set table columns to new values being passed and providing it to the insert command
         objVol.volunteers.InsertOnSubmit(vol);
         //commit insert with db
         objVol.SubmitChanges();
         return true;
     }
 }
 public ActionResult VolunteerUpdate(int Id, volunteer vol)
 {
     //If all the input were valid , then database will be updated
     if (ModelState.IsValid)
     {
         try
         {
             objVol.commitUpdate(Id, vol.position, vol.location, vol.requirement);
             return RedirectToAction("VolunteerIndex");
         }
         catch
         {
             return View();
         }
     }
     return View();
 }
 public ActionResult VolunteerInsert(volunteer vol)
 {
     if (ModelState.IsValid)
     {
         try
         {
             objVol.commitInsert(vol);
             return RedirectToAction("VolunteerIndex"); //On sucessful insert, redirect to the index view
         }
         catch
         {
             //Error handling, return to  view if something goes wrong
             return View();
         }
     }
     return View();
 }
 public ActionResult VolunteerDelete(int Id, volunteer vol)
 {
     //Selected value will be deleted from the database
     try
     {
         objVol.commitDelete(Id);
         return RedirectToAction("VolunteerIndex");
     }
     catch
     {
         return View();
     }
 }
 partial void Deletevolunteer(volunteer instance);
 partial void Updatevolunteer(volunteer instance);
 partial void Insertvolunteer(volunteer instance);