Пример #1
0
        public ActionResult DeleteConfirmed(string id)
        {
            t_staff t_staff = db.t_staff.Find(id);

            db.t_staff.Remove(t_staff);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "staff_id,first_name,last_name,address,dob,phone,email,gender,salary, join_date, citizenship_no, building_info,guardian_name, guardian_contact_info, guardian_relationship")] t_staff t_staff)
 {
     if (ModelState.IsValid)
     {
         staffMgr.UpdateStaff(t_staff);
         return(RedirectToAction("Index"));
     }
     return(View(t_staff));
 }
Пример #3
0
        public ActionResult Create([Bind(Include = "first_name,last_name,address,dob,phone,email,gender,salary, join_date, building_info, citizenship_no, img_file, guardian_name, guardian_contact_info, guardian_relationship")] t_staff t_staff)
        {
            if (ModelState.IsValid)
            {
                staffMgr.InsertStaff(t_staff);
                return(RedirectToAction("List"));
            }

            return(View(t_staff));
        }
Пример #4
0
 public bool UpdateStaffImage(t_staff staff)
 {
     try
     {
         _hmsDB.UpdateStaffImage(staff.staff_id, staff.img_file);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #5
0
        // GET: Staff/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            t_staff t_staff = db.t_staff.Find(id);

            if (t_staff == null)
            {
                return(HttpNotFound());
            }
            return(View(t_staff));
        }
Пример #6
0
        public ActionResult Deactivate(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            t_staff t_staff = db.t_staff.Find(id);

            if (t_staff == null)
            {
                return(HttpNotFound());
            }
            staffMgr.DeactivateStaff(t_staff);
            return(View("Index"));
        }
Пример #7
0
        public ActionResult UploadImage([Bind(Include = "staff_id")] t_staff t_staff, HttpPostedFileBase image)
        {
            if (ModelState.IsValid)
            {
                if (image != null)
                {
                    t_staff.img_file = ConvertToBytes(image);
                    staffMgr.UpdateStaffImage(t_staff);
                }
                //db.t_student.Add(t_student);
                //db.SaveChanges();
                return(RedirectToAction("Details", "Staff", new { id = t_staff.staff_id }));
            }

            return(View(t_staff));
        }
Пример #8
0
 public t_staff UpdateStaff(t_staff staff)
 {
     try
     {
         if (_hmsDB != null)
         {
             _hmsDB.UpdateStaff(staff.staff_id, staff.first_name, staff.last_name, staff.address, staff.dob, staff.phone, staff.email, staff.gender, staff.salary, staff.building_info, staff.guardian_name, staff.guardian_contact_info, staff.guardian_relationship, staff.join_date, staff.citizenship_no);
             return(staff);
         }
         return(null);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #9
0
 public bool RemoveStaff(t_staff staff)
 {
     throw new NotImplementedException();
 }
Пример #10
0
 public void DeactivateStaff(t_staff staff)
 {
     _hmsDB.DeactivateStaff(staff.staff_id);
 }