/// <summary> /// Deprecated Method for adding a new object to the Laboratory_Head EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToLaboratory_Head(Laboratory_Head laboratory_Head) { base.AddObject("Laboratory_Head", laboratory_Head); }
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); }
/// <summary> /// Create a new Laboratory_Head object. /// </summary> /// <param name="laboratory_HeadId">Initial value of the Laboratory_HeadId property.</param> /// <param name="laboratoryId">Initial value of the LaboratoryId property.</param> /// <param name="userName">Initial value of the UserName property.</param> /// <param name="firstName">Initial value of the FirstName property.</param> /// <param name="lastName">Initial value of the LastName property.</param> /// <param name="emailAdd">Initial value of the EmailAdd property.</param> /// <param name="contactNum">Initial value of the ContactNum property.</param> public static Laboratory_Head CreateLaboratory_Head(global::System.Int32 laboratory_HeadId, global::System.Int32 laboratoryId, global::System.String userName, global::System.String firstName, global::System.String lastName, global::System.String emailAdd, global::System.Int32 contactNum) { Laboratory_Head laboratory_Head = new Laboratory_Head(); laboratory_Head.Laboratory_HeadId = laboratory_HeadId; laboratory_Head.LaboratoryId = laboratoryId; laboratory_Head.UserName = userName; laboratory_Head.FirstName = firstName; laboratory_Head.LastName = lastName; laboratory_Head.EmailAdd = emailAdd; laboratory_Head.ContactNum = contactNum; return laboratory_Head; }