public ActionResult DeleteConfirmed(int id) { CAStudent cAStudent = db.Students.Find(id); db.Students.Remove(cAStudent); db.SaveChanges(); return(RedirectToAction("Index")); }
public virtual bool Validate(Student student) { if (IsAppliable(student)) { CAStudent caStudent = (CAStudent)student; return(ValidateStudent(caStudent)); } return(false); }
public ActionResult Edit([Bind(Include = "ID,Height,WasParentInService,FirstName,LastName,Gender,EntryScore,DoB,HasCriminalRecord,Province,BankBalance")] CAStudent cAStudent) { if (ModelState.IsValid && _validationService.ValidateStudent(cAStudent)) { db.Entry(cAStudent).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cAStudent)); }
protected override bool ValidateStudent(CAStudent student) { if (student.Gender == Gender.Male && student.Height >= MaleMinHeight && student.Age < MaleMaxAge) { return(true); } else if (student.Gender == Gender.Female && student.Height >= FemaleMinHeight && student.Age < FemaleMaxAge) { return(true); } return(false); }
// GET: CAStudents/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CAStudent cAStudent = db.Students.Find(id); if (cAStudent == null) { return(HttpNotFound()); } return(View(cAStudent)); }
protected override bool ValidateStudent(CAStudent student) { return((student.EntryScore + student.BonusEntryScore) > MinimalScore); }
protected abstract bool ValidateStudent(CAStudent student);