public ActionResult Create(int organizationId) { OrganizationDepartment organizationdepartment = new OrganizationDepartment(); organizationdepartment.OrganizationID = organizationId; ViewBag.PossibleOrganizationBusinessDivisions = organizationbusinessdivisionRepository.All; ViewBag.PossibleParentDepartments = organizationdepartmentRepository.All; return View(organizationdepartment); }
public ActionResult Create(OrganizationDepartment organizationdepartment,int organizationId) { if (ModelState.IsValid) { organizationdepartmentRepository.InsertOrUpdate(organizationdepartment); organizationdepartmentRepository.Save(); return RedirectToAction("Index",new { organizationId=organizationId }); } else { ViewBag.PossibleOrganizationBusinessDivisions = organizationbusinessdivisionRepository.All; ViewBag.PossibleParentDepartments = organizationdepartmentRepository.All; return View(organizationdepartment); } }
public void InsertOrUpdate(OrganizationDepartment organizationdepartment) { if (organizationdepartment.OrganizationDepartmentID == default(int)) { // New entity context.OrganizationDepartment.Add(organizationdepartment); } else { // Existing entity context.Entry(organizationdepartment).State = EntityState.Modified; } }
public ViewResult Search(OrganizationDepartment searchOrganizationDepartment,int organizationId) { if(searchOrganizationDepartment!=null) { } return View("Index",organizationdepartmentRepository.AllIncluding(organizationId,organizationdepartment => organizationdepartment.Organization, organizationdepartment => organizationdepartment.OrganizationBusinessDivision, organizationdepartment => organizationdepartment.ParentDepartment)); }