public ActionResult DeleteConfirmed(string id) { t_student t_student = db.t_student.Find(id); db.t_student.Remove(t_student); db.SaveChanges(); return(RedirectToAction("Index")); }
public bool UpdateStudentImage(t_student student) { try { _hmsDB.UpdateStudentImage(student.stud_id, student.img_file); return(true); } catch { return(false); } }
public ActionResult Edit([Bind(Include = "stud_id,first_name,last_name,address,dob,phone,email,gender,monthly_fee,school_info,room_no,building_info,guardian_name, guardian_contact_info, guardian_relationship")] t_student t_student) { if (ModelState.IsValid) { studentMgr.UpdateStudent(t_student); //db.Entry(t_student).State = EntityState.Modified; //db.SaveChanges(); return(RedirectToAction("Details", "Student", new { id = t_student.stud_id })); } return(View(t_student)); }
public t_student UpdateStudent(t_student student) { try { _hmsDB.UpdateStudent(student.stud_id, student.first_name, student.last_name, student.address, student.dob, student.phone, student.email, student.gender, student.monthly_fee, student.school_info, student.room_no, student.building_info, student.guardian_name, student.guardian_contact_info, student.guardian_relationship, student.enrollment_date); return(student); } catch { return(null); } }
// GET: Student/Details/5 public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } t_student t_student = db.t_student.Find(id); if (t_student == null) { return(HttpNotFound()); } return(View(t_student)); }
public ActionResult Deactivate(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } t_student t_student = db.t_student.Find(id); if (t_student == null) { return(HttpNotFound()); } studentMgr.DeactivateStudent(t_student); return(RedirectToAction("List", "Student")); }
public ActionResult UploadImage([Bind(Include = "stud_id")] t_student t_student, HttpPostedFileBase image) { if (ModelState.IsValid) { if (image != null) { t_student.img_file = ConvertToBytes(image); studentMgr.UpdateStudentImage(t_student); } //db.t_student.Add(t_student); //db.SaveChanges(); return(RedirectToAction("Details", "Student", new { id = t_student.stud_id })); } return(View(t_student)); }
public ActionResult Create([Bind(Include = "stud_id,first_name,last_name,address,dob,phone,email,gender,monthly_fee,school_info,room_no,building_info, guardian_name, guardian_contact_info, guardian_relationship, enrollment_date")] t_student t_student, HttpPostedFileBase image) { if (ModelState.IsValid) { if (image != null) { t_student.img_file = ConvertToBytes(image); } studentMgr.InsertStudent(t_student); //db.t_student.Add(t_student); //db.SaveChanges(); return(RedirectToAction("Details", "Student", new { id = t_student.stud_id })); } return(View(t_student)); }
public void DeactivateStudent(t_student student) { _hmsDB.DeactivateStudent(student.stud_id, DateTime.Now); }
public bool RemoveStudent(t_student student) { throw new NotImplementedException(); }
public t_student InsertStudent(t_student student) { _hmsDB.CreateStudent(student.first_name, student.last_name, student.address, student.dob, student.phone, student.email, student.gender, student.monthly_fee, student.school_info, student.room_no, student.building_info, student.guardian_name, student.guardian_contact_info, student.guardian_relationship, student.enrollment_date, student.img_file); return(student); // throw new NotImplementedException(); }