예제 #1
0
 public ActionResult Edit(ProfessorModel data)
 {
     bool result = repository.Edit(data);
     if(result == false)
         return View(data);
     return RedirectToAction("Index", "Home");
 }
예제 #2
0
 public bool Add(ProfessorModel data)
 {
     using (var DB = new MainContext())
     {
         DB.Professors.Add(data);
         DB.SaveChanges();
         return true;
     }
     return false;
 }
예제 #3
0
 public bool Edit(ProfessorModel data)
 {
     using (var DB = new MainContext())
     {
         DB.Professors.Attach(data);
         DB.Entry(data).State = System.Data.Entity.EntityState.Modified;
         DB.SaveChanges();
         return true;
     }
     return false;
 }