コード例 #1
0
        //creating an instance of findDoctor table (Model) as a parameter
        public bool commitInsert(findDoctor doctor)
        {
            //to ensure all data will be disposed of when finished
            using (objDoctor)
            {

                //using our model to set table columns to new values being passed and providing it to the insert command
                objDoctor.findDoctors.InsertOnSubmit(doctor);
                //commit insert with db
                objDoctor.SubmitChanges();
                return true;
            }
        }
コード例 #2
0
 public ActionResult doctorDelete(int Id, findDoctor doctor)
 {
     //Selected value will be deleted from the database
     try
     {
         objDoctor.commitDelete(Id);
         return RedirectToAction("doctorIndex");
     }
     catch
     {
         return View();
     }
 }
コード例 #3
0
 partial void DeletefindDoctor(findDoctor instance);
コード例 #4
0
 partial void UpdatefindDoctor(findDoctor instance);
コード例 #5
0
 partial void InsertfindDoctor(findDoctor instance);
コード例 #6
0
 public ActionResult doctorInsert(findDoctor doctor)
 {
     if (ModelState.IsValid)
     {
         try
         {
             objDoctor.commitInsert(doctor);
             return RedirectToAction("doctorIndex"); //On sucessful insert, redirect to the index view
         }
         catch
         {
             //Error handling, return to  view if something goes wrong
             return View();
         }
     }
     return View();
 }
コード例 #7
0
 public ActionResult doctorUpdate(int Id, findDoctor doctor)
 {
     //If all the input were valid , then database will be updated
     if (ModelState.IsValid)
     {
         try
         {
             objDoctor.commitUpdate(Id, doctor.fname, doctor.lname, doctor.speciality, doctor.branch_id, doctor.gender);
             return RedirectToAction("doctorIndex");
         }
         catch
         {
             return View();
         }
     }
     return View();
 }