Esempio n. 1
0
        //
        // GET: /Student/Create
        public ActionResult Edit(string id)
        {
            if (HttpContext != null)
            {
                UrlHelper url = new UrlHelper(HttpContext.Request.RequestContext);
                ViewBag.breadCrumbData  = "<a href='" + url.Action("Index", "Department") + "'>Department List</a>";
                ViewBag.breadCrumbData += " > Edit";
            }

            PLDepartment department = DepartmentClientService.GetDepartmentDetail(id);

            List <PLStaff>        st  = StaffClientService.GetStaffList();
            List <SelectListItem> res = new List <SelectListItem>();

            foreach (PLStaff tmp in st)
            {
                if (tmp.Department.deptName.Equals(id))
                {
                    res.Add(new SelectListItem {
                        Value = tmp.ID.ToString(), Text = tmp.FirstName + " " + tmp.LastName
                    });
                }
            }
            ViewBag.listStaff = res;

            return(View("Edit", department));
        }
Esempio n. 2
0
        public ActionResult Create(FormCollection collection, string departmentFilter)
        {
            if (departmentFilter == null)
            {
                departmentFilter = "Computer Science and Engineering";
            }

            try
            {
                PLStaff staffMember = new PLStaff();
                //staffMember.ID = Convert.ToInt32(collection["ID"]);
                staffMember.FirstName    = collection["FirstName"];
                staffMember.LastName     = collection["LastName"];
                staffMember.EmailAddress = collection["EmailAddress"];
                staffMember.Password     = collection["Password"];
                //staffMember.Department = new PLDepartment();
                staffMember.Department = DepartmentClientService.GetDepartmentDetail(departmentFilter);//collection.Get(5).ToString());
                //staffMember.Department.deptName = collection.Get(6).ToString();//1;//new PLDepartment();//ViewBag.//DepartmentClientService.CreateDepartment((PLDepartment)(collection["Department"]));//Convert.ToInt32(collection["Department"]);
                staffMember.isInstructor = Convert.ToBoolean(collection["InstructorBit"]);
                StaffClientService.CreateStaff(staffMember);
                return(RedirectToAction("Index"));// this brings us to the staff List page
            }
            catch (Exception e)
            {
                Console.Write(e.ToString());
                return(View());
            }
        }
Esempio n. 3
0
        public ActionResult Edit(FormCollection collection)
        {
            PLDepartment dpt = DepartmentClientService.GetDepartmentDetail(collection["ID"]);

            try
            {
                PLDepartment department = new PLDepartment();
                department.ID       = Convert.ToInt32(dpt.ID);
                department.deptName = collection["deptName"];
                department.chair_id = Convert.ToInt32(collection["chair_id"]);
                DepartmentClientService.UpdateDepartment(department);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 4
0
 // GET: /Staff/Edit
 public ActionResult Edit(int id, FormCollection collection)
 {
     try
     {
         PLStaff staffMember = new PLStaff();
         staffMember.ID           = id;
         staffMember.FirstName    = collection["FirstName"];
         staffMember.LastName     = collection["LastName"];
         staffMember.EmailAddress = collection["EmailAddress"];
         staffMember.Password     = collection["Password"];
         staffMember.Department   = DepartmentClientService.GetDepartmentDetail(collection["Department"]);
         staffMember.isInstructor = Convert.ToBoolean(collection["isInstructor"]);
         StaffClientService.UpdateStaff(staffMember);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }