/// <summary> /// The update areas. /// </summary> /// <param name="areas"> /// The areas. /// </param> /// <param name="serviceProviderId"> /// The service provider id. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> private bool UpdateAreas(WebServiceAreas areas, int serviceProviderId) { bool serviceAreaResponse; switch (areas.State) { case ObjectStatus.ObjectState.Update: case ObjectStatus.ObjectState.Delete: case ObjectStatus.ObjectState.Create: serviceAreaResponse = this.serviceProviderRepo.UpdateServiceArea( serviceProviderId, areas.ServiceAreas); break; case ObjectStatus.ObjectState.Read: serviceAreaResponse = true; break; default: serviceAreaResponse = false; break; } return(serviceAreaResponse); }
/// <summary> /// The create provider services. /// </summary> /// <param name="databaseProvider"> /// The database provider. /// </param> /// <returns> /// The <see cref="List"/>. /// </returns> private WebServiceAreas CreateProviderServices(ServiceProvider databaseProvider) { var databaseProviderServices = this.dataAccess.GetProviderServices(databaseProvider.ID); var services = databaseProviderServices.Select(databaseProviderService => databaseProviderService.ServiceID).ToList(); var webServiceAreas = new WebServiceAreas { ServiceAreas = services, State = ObjectStatus.ObjectState.Read }; return(webServiceAreas); }
public void MyTestInitialize() { this.target = new WebToDatabaseServiceProvider(); this.state = new State { Abbreviation = "OH", CountryID = 1, FullName = "Ohio", ID = 1 }; this.country = new Country { Abbreviation = "USA", ID = 1, FullName = "United States of America" }; this.county = new County { ID = 1, Name = "test county", StateId = 1, State = this.state }; this.contact = new ServiceProviderContact { Email = "*****@*****.**", Id = 1, Website = "www.test.org", PhoneNumber = "9373608284", HelpLine = "9373608888", State = ObjectStatus.ObjectState.Update }; this.locationContact = new ServiceProviderContactRequired { Email = "*****@*****.**", Id = 1, Website = "www.test.org", PhoneNumber = "9373608284", HelpLine = "9373608888", State = ObjectStatus.ObjectState.Update }; this.contactPerson = new ServiceProviderContactPerson { Id = 1, Contact = this.contact, FistName = "test", LastName = "user", JobTitle = "Tester", State = ObjectStatus.ObjectState.Update }; this.coverage1 = new Coverage { CountryId = 1, CountryName = "USA", CountyId = 1, CountyName = "Clark", Id = 1, State = ObjectStatus.ObjectState.Update, StateId = 1, StateName = "Ohio" }; this.coverage2 = new Coverage { CountryId = 1, CountryName = "USA", CountyId = 2, CountyName = "Clark 2", Id = 1, State = ObjectStatus.ObjectState.Update, StateId = 1, StateName = "Ohio" }; this.coverageList = new List <Coverage> { this.coverage1, this.coverage2 }; this.location1 = new ServiceProviderLocation { Name = "Location1", Coverage = this.coverageList, CountryId = 1, Contact = this.locationContact, ContactPerson = this.contactPerson, City = "testville 1", Id = 1, Display = true, Zip = "45344", Street = "Test way 1", StateId = this.state.ID, State = ObjectStatus.ObjectState.Update }; this.location2 = new ServiceProviderLocation { Name = "Location2", Coverage = this.coverageList, CountryId = 1, Contact = this.locationContact, City = "testville 2", Id = 2, Display = true, Zip = "45344", Street = "Test way 2", StateId = this.state.ID, State = ObjectStatus.ObjectState.Update }; this.locations = new List <ServiceProviderLocation> { this.location1, this.location2 }; this.webServiceAreas = new WebServiceAreas { ServiceAreas = new List <int> { 1, 2, 3 }, State = ObjectStatus.ObjectState.Update }; this.websiteServiceProvider = new WebsiteServiceProvider { Locations = this.locations, Services = this.webServiceAreas, Description = "Test Web Provider", DisplayRank = 1, Id = 1, Name = "test provider 1", Type = 1, IsActive = true, State = ObjectStatus.ObjectState.Update }; }