コード例 #1
0
        // GET: CompanyFollowUp/Edit/{id}
        public ActionResult Edit(int?id)
        {
            var organisationId = UserOrganisationId;

            TempData["CompanyFollowUpId"] = id;
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var companyFollowUp = _nidanBusinessService.RetrieveCompanyFollowUp(organisationId, id.Value);

            if (companyFollowUp == null)
            {
                return(HttpNotFound());
            }
            var viewModel = new CompanyFollowUpViewModel
            {
                CompanyFollowUp = companyFollowUp,
                HRContact1      = companyFollowUp.CompanyBranch.HRContact1,
                HREmail1        = companyFollowUp.CompanyBranch.HREmail1,
                HRName1         = companyFollowUp.CompanyBranch.HRName1,
                HRContact2      = companyFollowUp.CompanyBranch.HRContact2 ?? 0,
                HREmail2        = companyFollowUp.CompanyBranch.HREmail2,
                HRName2         = companyFollowUp.CompanyBranch.HRName2
            };

            return(View(viewModel));
        }
コード例 #2
0
        public ActionResult Edit(CompanyFollowUpViewModel companyFollowUpViewModel)
        {
            var organisationId = UserOrganisationId;
            var centreId       = UserCentreId;
            var personnelId    = UserPersonnelId;

            if (ModelState.IsValid)
            {
                companyFollowUpViewModel.CompanyFollowUp.OrganisationId = organisationId;
                companyFollowUpViewModel.CompanyFollowUp.CentreId       = centreId;
                companyFollowUpViewModel.CompanyFollowUp.CreatedBy      = personnelId;
                companyFollowUpViewModel.CompanyFollowUp = _nidanBusinessService.UpdateCompanyFollowUp(organisationId, companyFollowUpViewModel.CompanyFollowUp);
                return(RedirectToAction("Index"));
            }
            var viewModel = new CompanyFollowUpViewModel
            {
                CompanyFollowUp = companyFollowUpViewModel.CompanyFollowUp,
            };

            return(View(viewModel));
        }