예제 #1
0
        public ActionResult Create(CompanyBranchViewModel companyBranchViewModel)
        {
            var organisationId = UserOrganisationId;
            var personnelId    = UserPersonnelId;
            var centreId       = UserCentreId;

            if (ModelState.IsValid)
            {
                companyBranchViewModel.CompanyBranch.OrganisationId = organisationId;
                companyBranchViewModel.CompanyBranch.CreatedBy      = personnelId;
                companyBranchViewModel.CompanyBranch.CentreId       = centreId;
                companyBranchViewModel.CompanyBranch = _nidanBusinessService.CreateCompanyBranch(organisationId, companyBranchViewModel.CompanyBranch);
                return(RedirectToAction("Edit", "Company", new { id = companyBranchViewModel.CompanyBranch.CompanyId }));
            }
            companyBranchViewModel.Sectors = new SelectList(_nidanBusinessService.RetrieveSectors(organisationId, e => true).ToList(), "SectorId", "Name");
            return(View(companyBranchViewModel));
        }