Exemple #1
0
        //Adding staff
        public ActionResult Create()
        {
            if ((System.Web.HttpContext.Current.User != null) && System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
            {
                StaffSpecialty staffSpecialty = new StaffSpecialty();
                staffSpecialty.Specialities = db.Specialities.ToList();

                return(View(staffSpecialty));
            }
            else
            {
                return(RedirectToAction("index"));
            }
        }
Exemple #2
0
        //selects staff to update
        public ActionResult Update(int id)
        {
            if ((System.Web.HttpContext.Current.User != null) && System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
            {
                string         query          = "select * from staffs where staffId = @id";
                var            Parameter      = new SqlParameter("@id", id);
                Staff          staff          = db.Staffs.SqlQuery(query, Parameter).FirstOrDefault();
                StaffSpecialty staffSpecialty = new StaffSpecialty();
                staffSpecialty.staff        = staff;
                staffSpecialty.Specialities = db.Specialities.ToList();

                return(View(staffSpecialty));
            }
            else
            {
                return(RedirectToAction("index"));
            }
        }