public ActionResult Head(itmmAdminHead model, int section)
        {
            var l = from y in con.Laboratories
                   orderby y.LaboratoryName ascending
                   select y;
               ViewBag.LabList = l;
               var b = from y in con.Laboratory_Head
                   select y;
               ViewBag.HeadList = b;

               if (ModelState.IsValid)
               {
               AccountMembershipService MembershipService = new AccountMembershipService();
               MembershipCreateStatus createStatus = MembershipService.CreateUser(model.uname, model.password, model.eadd);
               if (createStatus == MembershipCreateStatus.Success)
               {
                   Roles.AddUserToRole(model.uname, "Head");
                   Laboratory_Head a = new Laboratory_Head();
                   a.FirstName = model.fname;
                   a.LastName = model.lname;
                   a.UserName = model.uname;
                   a.ContactNum = model.cnum;
                   a.EmailAdd = model.eadd;
                   a.LaboratoryId = section;

                   var x = (from y in con.Laboratories
                           where y.LaboratoryId == section
                           select y).FirstOrDefault();

                   x.UserName = model.uname;

                   con.AddToLaboratory_Head(a);

                   con.SaveChanges();

                   return RedirectToAction("Head", "Admin");
               }
               else
               {
                   ModelState.AddModelError("", AccountValidation.ErrorCodeToString(createStatus));
               }
               }
               return View(model);
        }
        public ActionResult Staff(itmmAdminStaff model, string type)
        {
            if (ModelState.IsValid) {
            AccountMembershipService MembershipService = new AccountMembershipService();
            MembershipCreateStatus createStatus = MembershipService.CreateUser(model.uname, model.password, model.eadd);
            if (createStatus == MembershipCreateStatus.Success) {

                Roles.AddUserToRole(model.uname, "Staff");

                Laboratory_Staff a = new Laboratory_Staff();
                a.FirstName = model.fname;
                a.LastName = model.lname;
                a.IdNumber = model.cnum;
                a.CourseAndYear = model.course;
                a.EmailAddress = model.eadd;
                a.Type = type;
                a.UserName = model.uname;
                //for LabId
                var c = (from y in con.Laboratories
                         where y.UserName == User.Identity.Name
                         select y.LaboratoryId).FirstOrDefault();
                a.LaboratoryId = c;
                con.AddToLaboratory_Staff(a);
                con.SaveChanges();

                return RedirectToAction("Staff", "Head");
            }
            else
            {
                ModelState.AddModelError("", AccountValidation.ErrorCodeToString(createStatus));
            }
            }
            return View(model);
        }