Beispiel #1
0
 public ActionResult Create(Gender gender)
 {
     if (ModelState.IsValid) {
         genderRepository.InsertOrUpdate(gender);
         genderRepository.Save();
         return RedirectToAction("Index");
     } else {
         return View();
     }
 }
Beispiel #2
0
 public void InsertOrUpdate(Gender gender)
 {
     if (gender.GenderID == default(int)) {
         // New entity
         context.Gender.Add(gender);
     } else {
         // Existing entity
         context.Entry(gender).State = EntityState.Modified;
     }
 }
Beispiel #3
0
 public ViewResult Search(Gender searchGender)
 {
     if(searchGender!=null)
     {
                     }
                 return View("Index",genderRepository.All);
 }