public ActionResult CreateOfficeProject(Offices office) { var listProjectType = proType.ListProjectTypes(); ViewBag.listProjectTypeDll = new SelectList(listProjectType, "Project_type_id", "Project_type_name"); var listPhaseTypes = phaseType.ListPhaseTypes(); ViewBag.listPhaseTypesDll = new SelectList(listPhaseTypes, "Phase_id", "Phase_name"); var listSpeedConnectionsTypes = speedType.ListSpeedConnectionTypes(); ViewBag.listSpeedConnectionsTypesDll = new SelectList(listSpeedConnectionsTypes, "Speed_connection_id", "Speed_connection_name"); var listOfficeScopes = offScop.ListOfficeScopes(); ViewBag.listOfficeScopesDll = new SelectList(listOfficeScopes, "Office_scope_id", "Office_scope_name"); if (office.Office_requestor_id != null) { //Changes the lab project null to 2=Laboratory office.Project_type = 1; try { if (!ModelState.IsValid) { return(View()); } var officeToAdd = Mapper.Map <DATA.Offices>(office); off.AddOfficeProject(officeToAdd); int x = (Int32)Session["UserType"]; switch (x) { case 1: return(RedirectToAction("PmProjects", "User")); case 2: return(RedirectToAction("UserMyProjects", "User")); case 3: return(RedirectToAction("Index", "Office")); case 4: return(RedirectToAction("Index", "Office")); default: return(RedirectToAction("Index", "Home")); } } catch (Exception ex) { throw ex; } } else { return(View()); } }
public ActionResult CreateOfficeProject(Offices office) { var listProjectType = proType.ListProjectTypes(); ViewBag.listProjectTypeDll = new SelectList(listProjectType, "Project_type_id", "Project_type_name"); var listPhaseTypes = phaseType.ListPhaseTypes(); ViewBag.listPhaseTypesDll = new SelectList(listPhaseTypes, "Phase_id", "Phase_name"); var listSpeedConnectionsTypes = speedType.ListSpeedConnectionTypes(); ViewBag.listSpeedConnectionsTypesDll = new SelectList(listSpeedConnectionsTypes, "Speed_connection_id", "Speed_connection_name"); var listOfficeScopes = offScop.ListOfficeScopes(); ViewBag.listOfficeScopesDll = new SelectList(listOfficeScopes, "Office_scope_id", "Office_scope_name"); if (office.Office_requestor_id != null) { //Changes the lab project null to 2=Laboratory office.Project_type = 1; try { if (!ModelState.IsValid) { return(View()); } var officeToAdd = Mapper.Map <DATA.Offices>(office); off.AddOfficeProject(officeToAdd); return(RedirectToAction("CreateOfficeProject")); } catch (Exception ex) { throw ex; } } else { return(View()); } }