コード例 #1
0
        //staff portal action
        public ActionResult Portal()
        {
            if (Session["StaffId"] != null)
              {
              var staffId = int.Parse(Session["StaffId"].ToString());
              var staff = db.Staffs.Find(staffId);
              var clinic = (from c in db.Clinics where c.UniqueId == staff.ClinicId select c).FirstOrDefault();

              var view = new StaffViewModel() { Staff = staff, Clinic = clinic };
              return View(view);
              }

            return RedirectToAction("Login", "Clinic");
        }
コード例 #2
0
 //public ActionResult AddStaff(Staff staff)
 //{
 //    db.Staffs.Add(staff);
 //    db.SaveChanges();
 //}
 //public ActionResult Test()
 //{
 //    var from
 //}
 public ActionResult Staff()
 {
     string sessionId = new HttpCookie("staffID").Value;
     if (sessionId != null)
     {
         int staffId = int.Parse(sessionId);
         Staff staff = (from s in db.Staffs where s.Id.Equals(staffId) select s).FirstOrDefault();
         Clinic clinic =
             (from c in db.Clinics select c).FirstOrDefault();
         var viewModel = new StaffViewModel
             {
                 Staff = staff,
                 Clinic = clinic
             };
         return View(viewModel);
     }
     return View("Login");
 }