예제 #1
0
        public override void PrepareForEditOrCreate(AgencyEntity entity = null)
        {
            base.PrepareForEditOrCreate(entity);

            ViewBag.CityId = new SelectList(
                _citiesService.GetCitiesIdsValues(), "id", "value", entity?.CityId);

            if (entity == null)
            {
                return;
            }

            ViewBag.AgencyUsersViewModel =
                _agencyUsersService.GetViewModelForIndex(new FilterArgs {
                AgencyId = entity.Id
            });

            ViewBag.AgencyPackagesViewModel =
                _agencyPackagesService.GetViewModelForIndex(new FilterArgs {
                AgencyId = entity.Id
            });

            ViewBag.ReturnUrl = User.IsInRole(RoleEntity.AgentAdminRoleName)
                ? Url.Action("Edit", "Agencies", new { id = entity.Id })
                : "/Agenicies/Index";
        }
예제 #2
0
        public override void PrepareForEditOrCreate(MaidEntity entity = null)
        {
            base.PrepareForEditOrCreate(entity);

            if (!User.IsInRole(RoleEntity.AdminRoleName))
            {
                ViewBag.AgencyId = User.Identity.GetAgency()?.Id;
            }
            else
            {
                ViewBag.AgencyId = new SelectList(
                    _agenciesService.GetAgenciesIdsValues(), "id", "value", entity?.AgencyId);
            }

            ViewBag.LivingCityId = new SelectList(
                _citiesService.GetCitiesIdsValues(), "id", "value", entity?.LivingCityId);

            ViewBag.NationalityId = new SelectList(
                _nationalitiesService.GetNationalitiesIdsValues(), "id", "value", entity?.NationalityId);

            ViewBag.VisaStatusId = new SelectList(
                _visaStatusService.GetVisaStatusesIdsValues(), "id", "value", entity?.VisaStatusId);

            ViewBag.AgencyPackageId = new SelectList(
                _agencyPacksService.GetAgencyPackagesIdsValues(entity.AgencyId ?? User.Identity.GetAgency()?.Id), "id", "value", entity?.AgencyPackageId);

            if (entity == null)
            {
                return;
            }

            ViewBag.ReturnUrl = Url.Action("Edit", "Maids", new { id = entity.Id });
            ViewBag.Passport  = entity.Passport;
            ViewBag.MaidEmploymentHistoriesViewModel =
                _maidEmploymentHistoriesService.GetViewModelForIndex(new FilterArgs {
                MaidId = entity.Id
            });
            ViewBag.MaidLanguagesViewModel =
                _maidLanguagesService.GetViewModelForIndex(new FilterArgs {
                MaidId = entity.Id
            });
            ViewBag.MaidSkillsViewModel = _maidSkillsService.GetViewModelForIndex(new FilterArgs {
                MaidId = entity.Id
            });
            ViewBag.MaidDocumentsViewModel =
                _maidDocumentsService.GetViewModelForIndex(new FilterArgs {
                MaidId = entity.Id
            });
        }