Esempio n. 1
0
        public EstablishmentModel GetEstablishmentAddressAndAccount(EstablishmentModel establishment)
        {
            establishment.Address = SelectEstablishmentAddres(establishment.EstablishmentId);
            establishment.Account = SelectEstablishmentAccount(establishment.EstablishmentId);

            return(establishment);
        }
        public void Test_CreateEstablishment_Sucess()
        {
            var establishment = new EstablishmentModel
            {
                CompanyName = "TestComapany",
                FantasyName = "TestFantasy",
                CNPJ        = "64766215000109",
                Email       = "*****@*****.**",
                Telephone   = "9874563213",
                Status      = true,
                Address     = new EstablishmentAddressModel
                {
                    Address = "TestAddres",
                    City    = "TestCity",
                    State   = "TestState"
                },
                CategoryId = 3,
                Account    = new EstablishmentAccountModel
                {
                    Account = "123456",
                    Agency  = "321564"
                }
            };

            var establishmentId = _establishmentService.CreateEstablishment(establishment);

            Assert.True(establishmentId != 0);
        }
Esempio n. 3
0
        public async Task <List <ChangeDescriptorDto> > GetModelChangesAsync(EstablishmentModel original, EstablishmentModel model)
        {
            var changes = ReflectionHelper.DetectChanges(model, original, typeof(IEBTModel));
            var retVal  = new List <ChangeDescriptorDto>();

            foreach (var change in changes)
            {
                if (_cachedLookupService.IsLookupField(change.Name))
                {
                    change.OldValue = await _cachedLookupService.GetNameAsync(change.Name, change.OldValue.ToInteger());

                    change.NewValue = await _cachedLookupService.GetNameAsync(change.Name, change.NewValue.ToInteger());
                }

                if (change.Name.EndsWith("Id", StringComparison.Ordinal))
                {
                    change.Name = change.Name.Substring(0, change.Name.Length - 2);
                }
                change.Name = change.Name.Replace("_", "").Replace(nameof(IEBTModel) + ".", string.Empty);
                change.Name = change.Name.ToProperCase(true);

                retVal.Add(new ChangeDescriptorDto
                {
                    Name     = change.DisplayName ?? change.Name,
                    NewValue = change.NewValue.Clean(),
                    OldValue = change.OldValue.Clean()
                });
            }

            await DetectSENChanges(original, model, retVal);

            return(retVal);
        }
Esempio n. 4
0
        public ActionResult AddOrUpdate(EstablishmentModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var isCreated     = model.Id == Guid.Empty;
            var establishment = new Establishments();

            if (!isCreated)
            {
                establishment = EstablishmentRepository.GetById(model.Id);
            }

            establishment.Name        = model.Name;
            establishment.Academie_Id = model.AcademyId;
            establishment.Academies   = AcademyRepository.GetByName(model.Academy);
            establishment.Address     = model.Address;
            establishment.PostCode    = model.PostCode;
            establishment.Town        = model.Town;
            establishment.User_Id     = model.UserId;
            establishment.Users       = UserRepository.GetById(model.UserId);

            if (isCreated)
            {
                EstablishmentRepository.Add(establishment);
            }
            EstablishmentRepository.Save();

            return(Redirect(Url.Action("Get", "Establishment", new { id = establishment.Id })));
        }
        public void Test_CreateEstablishment_Error()
        {
            var establishment = new EstablishmentModel
            {
                EstablishmentId = 1,
                CompanyName     = "TestComapany",
                FantasyName     = "TestFantasy",
                CNPJ            = "37349399000120",
                Email           = "*****@*****.**",
                Telephone       = "9874563213",
                Status          = true,
                Address         = new EstablishmentAddressModel
                {
                    Address = "TestAddres",
                    City    = "TestCity",
                    State   = "TestState"
                },
                CategoryId = 3,
                Account    = new EstablishmentAccountModel
                {
                    Account = "123456",
                    Agency  = "321564"
                }
            };

            Assert.Throws <ArgumentException>(() => _establishmentService.CreateEstablishment(establishment));
        }
Esempio n. 6
0
        public ActionResult GetAll()
        {
            var models = EstablishmentRepository.All()
                         .OrderBy(e => e.Academies.Name)
                         .Select(e => EstablishmentModel.ToModel(e));

            return(View(models));
        }
Esempio n. 7
0
        public bool SaveEstablishment(EstablishmentModel establishment)
        {
            UpdateEstablishment(establishment);
            UpdateEstablishmentAddress(establishment.Address, establishment.EstablishmentId);
            UpdateEstablishAccount(establishment.Account, establishment.EstablishmentId);

            return(true);
        }
        public async Task <ApiResponse> PartialUpdateAsync(EstablishmentModel model, EstablishmentFieldList fieldsToUpdate, IPrincipal principal)
        {
            Guard.IsNotNull(model.Urn, () => new Exception("Urn on the model parameter cannot be null for a partial update"));

            var propertiesToUpdate = ReflectionHelper.GetProperties(fieldsToUpdate)
                                     .Where(property => ReflectionHelper.GetPropertyValue <bool>(fieldsToUpdate, property))
                                     .Select(x => new { Key = x, Value = ReflectionHelper.GetPropertyValue(model, x) });

            var payload = propertiesToUpdate.ToDictionary(x => x.Key, x => x.Value);

            return(await _httpClient.PatchAsync($"establishment/{model.Urn}", payload, principal));
        }
Esempio n. 9
0
        public EstablishmentDisplayEditPolicy Initialise(EstablishmentModel establishment)
        {
            if (establishment.EstablishmentTypeGroupId == (int)eLookupEstablishmentTypeGroup.ChildrensCentres)
            {
                HeadteacherLabel       = "Manager";
                HeadEmailAddressLabel  = "Manager email";
                MainEmailAddressLabel  = "Centre email";
                EstablishmentTypeLabel = "Provider type";
            }

            return(this);
        }
 public async Task <ValidationEnvelopeDto> ValidateAsync(EstablishmentModel model, IPrincipal principal)
 {
     if (!model.HelpdeskPreviousLocalAuthorityId.HasValue)
     {
         model.HelpdeskPreviousLocalAuthorityId = 189; // marcel: for the timebeing lets just hack it and put it in tech debt to resolve. At this stage it feels like we have more pressing matters
     }
     if (model.SENIds != null && !model.SENIds.Any())
     {
         model.SENIds = null;                                              // they don't like an empty array.
     }
     return((await _httpClient.PutAsync <ValidationEnvelopeDto>($"establishment/validate", model, principal)).Response);
 }
        public ActionResult CreateEstablishment([FromBody] EstablishmentModel establishment)
        {
            try
            {
                var id = _establishmentService.CreateEstablishment(establishment);

                return(Ok(new { Created = true, IdInsered = id }));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
        public ActionResult UpdateEstablishment(EstablishmentModel establishment)
        {
            try
            {
                var sucess = _establishmentService.SaveEstablishment(establishment);

                return(Ok(sucess));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
        public bool UpdateEstablishment(EstablishmentModel request)
        {
            #region .: Query :.
            var query = @"
                UPDATE [dbo].[Establishment]
                    SET [CompanyName] = @CompanyName, [FantasyName] = @FantasyName, [CNPJ] = @CNPJ, [Email] = @Email,
                            [Telephone] = @Telephone, [Status] = @Status, [CategoryId] = @CategoryId
                                WHERE [EstablishmentId] = @EstablishmentId";
            #endregion
            ExecuteQuery(query, ConnectionString, request);

            return(true);
        }
        public int InsertEstablishment(EstablishmentModel request)
        {
            #region .: Query :.
            var query = @"
                INSERT INTO [dbo].[Establishment]
                    ([CompanyName], [FantasyName], [CNPJ], [Email], [Telephone], [DateOfRegistration], [Status], [CategoryId])
                        VALUES (@CompanyName, @FantasyName, @CNPJ, @Email, @Telephone, @DateOfRegistration, @Status, @CategoryId)
                SELECT CAST(SCOPE_IDENTITY() AS INT) [EstablishmentId]";
            #endregion
            var establishmentId = ExecuteGetObj <int>(query, ConnectionString, request);

            return(establishmentId);
        }
        public async Task Estab_AddOrReplaceEstablishmentAddress()
        {
            var nationalities = new List <LookupDto>
            {
                new LookupDto {
                    Code = "1", Id = 1, Name = "Nationality 1"
                },
                new LookupDto {
                    Code = "2", Id = 2, Name = "Nationality 2"
                },
                new LookupDto {
                    Code = "3", Id = 3, Name = "Nationality 3"
                }
            };

            var counties = new List <LookupDto>
            {
                new LookupDto {
                    Code = "1", Id = 1, Name = "County 1"
                },
                new LookupDto {
                    Code = "2", Id = 2, Name = "County 2"
                },
                new LookupDto {
                    Code = "3", Id = 3, Name = "County 3"
                }
            };

            var establishment = new EstablishmentModel
            {
                Urn  = 5,
                Name = "test"
            };

            GetMock <IGroupReadService>().Setup(x => x.GetAllByEstablishmentUrnAsync(It.IsAny <int>(), It.IsAny <IPrincipal>())).ReturnsAsync(new[] { new GroupModel {
                                                                                                                                                          Name = "Group 1", GroupUId = 1000
                                                                                                                                                      } });
            GetMock <ICachedLookupService>().Setup(c => c.NationalitiesGetAllAsync()).ReturnsAsync(() => nationalities);
            GetMock <ICachedLookupService>().Setup(c => c.CountiesGetAllAsync()).ReturnsAsync(() => counties);
            GetMock <IEstablishmentReadService>().Setup(e => e.GetAsync(It.IsAny <int>(), It.IsAny <IPrincipal>())).ReturnsAsync(() => new ServiceResultDto <EstablishmentModel>(establishment));
            GetMock <IEstablishmentReadService>().Setup(e => e.GetEditPolicyAsync(It.IsAny <EstablishmentModel>(), It.IsAny <IPrincipal>())).ReturnsAsync(() => new EstablishmentEditPolicyEnvelope {
                EditPolicy = new EstablishmentDisplayEditPolicy {
                    IEBTDetail = new IEBTDetailDisplayEditPolicy {
                        AccommodationChangedId = true
                    }
                }
            });

            await ObjectUnderTest.AddOrReplaceEstablishmentAddressAsync(5, "test");
        }
        public static EstablishmentEntity Map(EstablishmentModel model)
        {
            if (model == null)
            {
                return(null);
            }

            return(new EstablishmentEntity()
            {
                Id = model.Id,
                Name = model.Name,
                Description = model.Description,
                Preview = ImageMapper.Map(model.Preview),
            });
        }
Esempio n. 17
0
        public ActionResult AddOrUpdate(Guid?id, Guid?academyId)
        {
            var model = new EstablishmentModel();

            model.UserId = GlobalVariables.UserId;
            if (id.HasValue)
            {
                model = EstablishmentModel.ToModel(EstablishmentRepository.GetById(id.Value));
            }
            if (academyId.HasValue)
            {
                model.AcademyId = academyId.Value;
            }

            return(View(model));
        }
Esempio n. 18
0
        public int InsertEstablishment(EstablishmentModel establishment)
        {
            int establishmentId = 0;

            if (establishment.CNPJ != null || establishment.CompanyName != null)
            {
                _validateService.ValidCNPJ(establishment.CNPJ);
                _validateService.ValidEmail(establishment.Email);

                establishment.DateOfRegistration = DateTime.Now;

                establishmentId = _establishmentRepository.InsertEstablishment(establishment);
            }

            return(establishmentId);
        }
        public EstablishmentDisplayEditPolicy Initialise(EstablishmentModel establishment)
        {
            if (establishment.EstablishmentTypeGroupId == (int)eLookupEstablishmentTypeGroup.ChildrensCentres)
            {
                HeadteacherLabel       = "Manager";
                HeadEmailAddressLabel  = "Manager email";
                EstablishmentTypeLabel = "Provider type";
            }

            if (establishment.TypeId == (int)eLookupEstablishmentType.OnlineProvider)
            {
                HeadteacherLabel           = "Headteacher/Manager";
                HeadPreferredJobTitleLabel = "Headteacher/Manager preferred job title";
                HeadEmailAddressLabel      = "Headteacher/Manager email address";
            }

            return(this);
        }
Esempio n. 20
0
        private async Task DetectSENChanges(EstablishmentModel original, EstablishmentModel model, List <ChangeDescriptorDto> retVal)
        {
            var originalSenIds = (original.SENIds ?? new int[0]).OrderBy(x => x);
            var newSenIds      = (model.SENIds ?? new int[0]).OrderBy(x => x);

            if (!originalSenIds.SequenceEqual(newSenIds))
            {
                var sens = await _cachedLookupService.SpecialEducationNeedsGetAllAsync();

                var originalSenNames = StringUtil.SentencifyNoFormating(originalSenIds.Select(x => sens.FirstOrDefault(s => s.Id == x)?.Name).ToArray());
                var newSenNames      = StringUtil.SentencifyNoFormating(newSenIds.Select(x => sens.FirstOrDefault(s => s.Id == x)?.Name).ToArray());
                retVal.Add(new ChangeDescriptorDto
                {
                    Name     = "Type of SEN provision",
                    NewValue = newSenNames,
                    OldValue = originalSenNames
                });
            }
        }
        public async Task <List <ChangeDescriptorDto> > GetModelChangesAsync(EstablishmentModel original, EstablishmentModel model, EstablishmentApprovalsPolicy approvalsPolicy)
        {
            var changes = ReflectionHelper.DetectChanges(model, original, new[] { typeof(IEBTModel), typeof(ProprietorModel) });

            changes.AddRange(await DetectAdditionalAddressChanges(original, model));
            changes.AddRange(await DetectProprietorsChanges(original, model));
            var retVal = new List <ChangeDescriptorDto>();

            var approvalFields = approvalsPolicy.GetFieldsRequiringApproval();

            foreach (var change in changes)
            {
                if (_cachedLookupService.IsLookupField(change.Name))
                {
                    change.OldValue = await _cachedLookupService.GetNameAsync(change.Name, change.OldValue.ToInteger());

                    change.NewValue = await _cachedLookupService.GetNameAsync(change.Name, change.NewValue.ToInteger());
                }

                if (change.DisplayName == null)
                {
                    change.DisplayName = PropertyName2Label(change.Name);
                }

                retVal.Add(new ChangeDescriptorDto
                {
                    Id               = change.Name,
                    Name             = change.DisplayName ?? change.Name,
                    NewValue         = change.NewValue.Clean(),
                    OldValue         = change.OldValue.Clean(),
                    Tag              = change.Tag,
                    RequiresApproval = (change.Tag == "additionaladdress" && approvalsPolicy.AdditionalAddresses.RequiresApproval) ||
                                       //(change.Tag == "proprietors" && approvalsPolicy.IEBTDetail.Proprietors.RequiresApproval) ||
                                       //(change.Name.Contains(nameof(approvalsPolicy.IEBTDetail.ChairOfProprietor)) && approvalsPolicy.IEBTDetail.ChairOfProprietor.RequiresApproval) ||
                                       approvalFields.Contains(change.Name, StringComparer.OrdinalIgnoreCase),
                    ApproverName = approvalsPolicy.GetApproverName(change.Name)
                });
            }

            await DetectSENChanges(original, model, retVal);

            return(retVal);
        }
        public async Task SaveAsync(EstablishmentModel model, bool overrideCR, DateTime?effectiveDate, IPrincipal principal)
        {
            if (!model.HelpdeskPreviousLocalAuthorityId.HasValue)
            {
                model.HelpdeskPreviousLocalAuthorityId = 189; // marcel: for the timebeing lets just hack it and put it in tech debt to resolve. At this stage it feels like we have more pressing matters
            }
            var parameters = new Dictionary <string, string>
            {
                [nameof(overrideCR).ToLower()] = (principal.IsInRole(EdubaseRoles.ROLE_BACKOFFICE) && overrideCR).ToString().ToLower(),
                [nameof(effectiveDate)]        = effectiveDate?.ToString("yyyy-MM-dd")
            };
            var queryString = string.Join("&", parameters.Where(x => x.Value != null).Select(x => $"{x.Key}={x.Value}"));

            model.Location = null; // always set to null just in case the easting/northing values have been changed - apparently by setting this to null, it signifies to Texuna, they should re-calc the lat/long values.

            if (model.SENIds != null && !model.SENIds.Any())
            {
                model.SENIds = null;                                              // they don't like an empty array.
            }
            await _httpClient.PutAsync($"establishment?{queryString}", model, principal);
        }
Esempio n. 23
0
        public int CreateEstablishment(EstablishmentModel establishment)
        {
            establishment.EstablishmentId = CheckEstablishment(establishment.CNPJ);

            if (establishment.EstablishmentId == 0 && establishment.CompanyName != null && establishment.CNPJ != null)
            {
                establishment.EstablishmentId = InsertEstablishment(establishment);
                establishment.Address.EstablishmentAddressId = InsertEstablishmentAddress(establishment.Address, establishment.EstablishmentId);
                establishment.Account.EstablishmentAccountId = InsertEstablishmentAccount(establishment.Account, establishment.EstablishmentId);
            }
            else if (establishment.EstablishmentId == 0 && establishment.CompanyName == null && establishment.CNPJ == null)
            {
                throw new ArgumentException("Nome da empresa ou CNPJ vazio!");
            }
            else
            {
                throw new ArgumentException("Estabelecimento já cadastrado!");
            }

            return(establishment.EstablishmentId);
        }
        private IReadOnlyCollection <SitemapNode> GetEstablishmentTabs(EstablishmentModel item, double?priority)
        {
            var urlHelper = this.Url;
            var nodes     = new List <SitemapNode>();

            nodes.Add(BuildNode("Details", "Establishment", new { area = "Establishments", id = item.Urn }, "school-dashboard", priority, SitemapFrequency.Weekly, item.LastUpdatedUtc));
            nodes.Add(BuildNode("Details", "Establishment", new { area = "Establishments", id = item.Urn }, "school-links", priority, SitemapFrequency.Weekly, item.LastUpdatedUtc));
            nodes.Add(BuildNode("Details", "Establishment", new { area = "Establishments", id = item.Urn }, "school-location", priority, SitemapFrequency.Weekly, item.LastUpdatedUtc));

            // not all establishments have the governance page displayed for the general public
            var displayPolicy = new EstablishmentDisplayEditPolicy {
                IEBTDetail = new IEBTDetailDisplayEditPolicy()
            };
            var tabPolicy = new TabDisplayPolicy(item, displayPolicy, User);

            if (tabPolicy.Governance)
            {
                nodes.Add(BuildNode("Details", "Establishment", new { area = "Establishments", id = item.Urn }, "school-governance", priority, SitemapFrequency.Weekly, item.LastUpdatedUtc));
            }

            return(nodes);
        }
Esempio n. 25
0
        public TabDisplayPolicy(EstablishmentModel model, EstablishmentDisplayEditPolicy policy, IPrincipal principal)
        {
            IEBT = policy.IEBTDetail.Any();

            Helpdesk = policy.HelpdeskNotes;

            Governance = model.TypeId.OneOfThese(
                ET.Academy1619Converter,
                ET.Academy1619SponsorLed,
                ET.AcademyAlternativeProvisionConverter,
                ET.AcademyAlternativeProvisionSponsorLed,
                ET.AcademyConverter,
                ET.AcademySpecialConverter,
                ET.AcademySpecialSponsorLed,
                ET.AcademySponsorLed,
                ET.FurtherEducation,
                ET.SixthFormCentres,
                ET.CityTechnologyCollege,
                ET.FreeSchools,
                ET.FreeSchools1619,
                ET.FreeSchoolsAlternativeProvision,
                ET.FreeSchoolsSpecial,
                ET.StudioSchools,
                ET.UniversityTechnicalCollege,
                ET.CommunitySchool,
                ET.CommunitySpecialSchool,
                ET.FoundationSchool,
                ET.FoundationSpecialSchool,
                ET.LANurserySchool,
                ET.PupilReferralUnit,
                ET.VoluntaryAidedSchool,
                ET.VoluntaryControlledSchool);

            Location = new[]
            {
                policy.RSCRegionId, policy.GovernmentOfficeRegionId, policy.AdministrativeDistrictId, policy.AdministrativeWardId, policy.ParliamentaryConstituencyId,
                policy.UrbanRuralId, policy.GSSLAId, policy.Easting, policy.Northing, policy.CASWardId, policy.MSOAId, policy.LSOAId
            }.Any(x => x == true);
        }
 public async Task <ApiResponse <int> > CreateNewAsync(EstablishmentModel model, bool generateEstablishmentNumber, IPrincipal principal)
 {
     return(Unwrap(await _httpClient.PostAsync <ApiResultDto <int> >($"establishment?autogenestabno={generateEstablishmentNumber.ToString().ToLower()}", model, principal)));
 }
 public async Task <ValidationEnvelopeDto> ValidateCreateAsync(EstablishmentModel model, bool generateEstablishmentNumber, IPrincipal principal)
 {
     return((await _httpClient.PostAsync <ValidationEnvelopeDto>($"establishment/validate?autogenestabno={generateEstablishmentNumber.ToString().ToLower()}", model, principal)).Response);
 }
        public async Task Estab_EditDetails()
        {
            var establishment = new EstablishmentModel
            {
                Urn       = 100000,
                IEBTModel = new IEBTModel()
            };

            var editEstabModel = new EditEstablishmentModel
            {
                Urn = 100000,
                Address_CityOrTown = "cityOrTown",
                Address_CountryId  = 1,
                Address_CountyId   = 2,
                Address_Line1      = "line1",
                Address_Locality   = "locality",
                Address_Line3      = "line3",
                Address_PostCode   = "postcode",
                Address_UPRN       = "uprn",
                Northing           = 3,
                Easting            = 4,
                ChairOfProprietor  = new ProprietorViewModel()
            };

            var replacementAddress = new AddOrReplaceAddressViewModel
            {
                Target       = "main",
                Town         = "replacementTown",
                CountryId    = 5,
                CountyId     = 8,
                Street       = "replacementStreet",
                Locality     = "replacementLocality",
                Address3     = "replacementAddress3",
                PostCode     = "replacementPostcode",
                SelectedUPRN = "1234",
                Northing     = 7,
                Easting      = 5
            };

            var address = UriHelper.SerializeToUrlToken(replacementAddress);

            GetMock <IGroupReadService>().Setup(x => x.GetAllByEstablishmentUrnAsync(It.IsAny <int>(), It.IsAny <IPrincipal>())).ReturnsAsync(new[] { new GroupModel {
                                                                                                                                                          Name = "Group 1", GroupUId = 1000
                                                                                                                                                      } });
            GetMock <IEstablishmentReadService>().Setup(e => e.GetAsync(It.IsAny <int>(), It.IsAny <IPrincipal>())).ReturnsAsync(() => new ServiceResultDto <EstablishmentModel>(establishment));
            GetMock <IMapper>().Setup(m => m.Map <EditEstablishmentModel>(establishment)).Returns(editEstabModel);
            GetMock <IMapper>().Setup(m => m.Map(It.IsAny <IEBTModel>(), editEstabModel)).Returns(editEstabModel);
            GetMock <IEstablishmentReadService>().Setup(e => e.GetEditPolicyAsync(establishment, It.IsAny <IPrincipal>())).ReturnsAsync(() => new EstablishmentEditPolicyEnvelope {
                EditPolicy = new EstablishmentDisplayEditPolicy {
                    IEBTDetail = new IEBTDetailDisplayEditPolicy()
                }
            });
            GetMock <IPrincipal>().Setup(p => p.IsInRole(It.IsAny <string>())).Returns(true);
            GetMock <ICSCPService>().Setup(x => x.CheckExists(It.IsAny <int>(), It.IsAny <string>())).ReturnsAsync(true);
            GetMock <ICSCPService>().Setup(x => x.SchoolURL(It.IsAny <int>(), It.IsAny <string>())).Returns("https://cscp.azurewebsites.net/school/123456");
            GetMock <IFBService>().Setup(x => x.CheckExists(It.IsAny <int>())).ReturnsAsync(true);
            GetMock <IFBService>().Setup(x => x.SchoolURL(It.IsAny <int>())).Returns("https://sfb.azurewebsites.net/school/detail?urn=123456");

            SetupCachedLookupService();

            var response = await ObjectUnderTest.EditDetails(4, address);

            Assert.That(response is ViewResult);
            var viewResult = (ViewResult)response;

            Assert.That(viewResult.Model is EditEstablishmentModel);
            var model = (EditEstablishmentModel)viewResult.Model;

            Assert.That(model.Address_CityOrTown == replacementAddress.Town);
            Assert.That(model.Address_CountryId == replacementAddress.CountryId);
            Assert.That(model.Address_CountyId == replacementAddress.CountyId);
            Assert.That(model.Address_Line1 == replacementAddress.Street);
            Assert.That(model.Address_Locality == replacementAddress.Locality);
            Assert.That(model.Address_Line3 == replacementAddress.Address3);
            Assert.That(model.Address_PostCode == replacementAddress.PostCode);
            Assert.That(model.Address_UPRN == replacementAddress.SelectedUPRN);
            Assert.That(model.Northing == replacementAddress.Northing);
            Assert.That(model.Easting == replacementAddress.Easting);
        }
Esempio n. 29
0
 public async Task <EstablishmentDisplayEditPolicy> GetEditPolicyAsync(EstablishmentModel establishment, IPrincipal user)
 => (await _httpClient.GetAsync <EstablishmentDisplayEditPolicy>($"establishment/{establishment.Urn}/edit-policy", user)).GetResponse().Initialise(establishment);
Esempio n. 30
0
        public async Task <List <ChangeDescriptorDto> > GetModelChangesAsync(EstablishmentModel model, IPrincipal principal)
        {
            var originalModel = (await GetAsync(model.Urn.Value, principal)).GetResult();

            return(await GetModelChangesAsync(originalModel, model));
        }