示例#1
0
        private void FillTestData(ModelBuilder modelBuilder)
        {
            var to1 = new TransportOrganization {
                Id       = 1L,
                Name     = @"ООО ""Трансавтолиз""",
                TimeZone = "Europe/Moscow",
                WebSite  = "http://avtoline.ru"
            };

            var to2 = new TransportOrganization {
                Id       = 2L,
                Name     = @"ГУП ""Мосгортранс""",
                TimeZone = "Europe/Moscow",
                WebSite  = "http://mosgortrans.ru"
            };

            modelBuilder.Entity <TransportOrganization>().HasData(
                to1,
                to2
                );

            modelBuilder.Entity <Route>().HasData(
                new
            {
                Id             = 1L,
                Number         = "591",
                Name           = @"Метро ""Войковская"" - Станция Ховрино",
                Type           = TransportType.Bus,
                OrganizationId = to1.Id
            },
                new
            {
                Id             = 2L,
                Number         = "191",
                Name           = @"Метро ""Селигерская"" - Станция Ховрино",
                Type           = TransportType.Bus,
                OrganizationId = to1.Id
            },
                new
            {
                Id             = 3L,
                Number         = "215к",
                Name           = @"Метро ""Селигерская"" - Станция Ховрино",
                Type           = TransportType.Bus,
                OrganizationId = to2.Id
            },
                new
            {
                Id             = 4L,
                Number         = "59",
                Name           = @"Метро ""Сокол"" - Улица Генерала Глаголева",
                Type           = TransportType.Trolley,
                OrganizationId = to2.Id
            }
                );
        }
示例#2
0
        public Task UpdateTransportOrganization(TransportOrganization transportOrganization)
        {
            var foundTransportOrganization = GetAreaType(transportOrganization.Id).Result;

            if (foundTransportOrganization == null)
            {
                AddTransportOrganization(transportOrganization);
            }
            else
            {
                if (foundTransportOrganization != transportOrganization)
                {
                    _transportOrganizations.Remove(foundTransportOrganization);
                    _transportOrganizations.Add(transportOrganization);
                }
            }
            return(Task.CompletedTask);
        }
示例#3
0
 public Task RemoveTransportOrganization(TransportOrganization transportOrganization)
 {
     _transportOrganizations.Remove(transportOrganization);
     return(Task.CompletedTask);
 }
示例#4
0
 public Task AddTransportOrganization(TransportOrganization transportOrganization)
 {
     _transportOrganizations.Add(transportOrganization);
     return(Task.CompletedTask);
 }