Example #1
0
 public StationLineDetail(StationLine line)
 {
     this.Id          = line.Id;
     this.LineId      = line.LineId;
     this.StationId   = line.StationId;
     this.OrderNumber = line.OrderNumber;
 }
Example #2
0
        public int Update(StationLine stationLine)
        {
            if (stationLine == null)
            {
                throw new ArgumentNullException(nameof(stationLine), "StationLine should not be null");
            }

            if (stationLine.LineId <= 0)
            {
                throw new InvalidOperationException("Invalid train line. Line Id value is missing");
            }

            if (stationLine.StationId <= 0)
            {
                throw new InvalidOperationException("Invalid station. Station Id value is missing");
            }

            if (AnyStationExist(stationLine.LineId, stationLine.StationId))
            {
                throw new InvalidOperationException("Station Line mapping already exists.");
            }

            unitOfWork.StationLines.Update(stationLine);
            return(unitOfWork.Complete());
        }
Example #3
0
        public IHttpActionResult PostStationLine(StationLine stationLine)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            unitOfWork.StationLines.Add(stationLine);
            unitOfWork.Complete();

            return(CreatedAtRoute("DefaultApi", new { id = stationLine.Id }, stationLine));
        }
Example #4
0
 internal StationLineEntity(MetroWebEntity metroWeb, StationLine stationLine)
 {
     this.metroWeb      = metroWeb;
     this.stationLine   = stationLine;
     this.stationLineId = stationLine.StationLineId.Value;
     this.lineId        = stationLine.LineId.Value;
     this.stationId     = stationLine.StationId.Value;
     this.timeWait      = stationLine.TimeWait.Value;
     this.timeArrived   = stationLine.TimeArrived.Value;
     this.startTime     = stationLine.StartTime.Value;
     this.endTime       = stationLine.EndTime.Value;
 }
Example #5
0
        public async Task AddLineToStation(int stationId, int lineId)
        {
            if (!(await _context.StationLines.AnyAsync(sl => sl.LineId == lineId && sl.StationId == stationId)))
            {
                var statLine = new StationLine()
                {
                    LineId    = lineId,
                    StationId = stationId
                };

                Add(statLine);
                await SaveAll();
            }
        }
Example #6
0
        public int Delete(StationLine stationLine)
        {
            if (stationLine == null)
            {
                throw new ArgumentNullException(nameof(stationLine), "StationLine should not be null");
            }

            if (stationLine.LineId <= 0)
            {
                throw new InvalidOperationException("Invalid train line. Line Id value is missing");
            }

            if (stationLine.StationId <= 0)
            {
                throw new InvalidOperationException("Invalid station. Station Id value is missing");
            }

            unitOfWork.StationLines.Delete(stationLine);
            return(unitOfWork.Complete());
        }
Example #7
0
        public int CreateStationLine(StationLine newStationLine)
        {
            if (newStationLine == null)
            {
                throw new ArgumentNullException(nameof(newStationLine), "Station should not be null");
            }

            if (AnyStationExist(newStationLine.LineId, newStationLine.StationId))
            {
                throw new InvalidOperationException("Station Line mapping already exists.");
            }

            if (OrderNumberExists(newStationLine.LineId, newStationLine.OrderNumber))
            {
                throw new InvalidOperationException("Already given order number exists.");
            }

            unitOfWork.StationLines.Add(newStationLine);
            return(unitOfWork.Complete());
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidateInput())
                {
                    int.TryParse(txtStationOrder.Text, out int stationOrder);
                    StationLine stationLine = new StationLine()
                    {
                        LineId = (int)cmbTrainLine.SelectedValue, StationId = (int)cmbStation.SelectedValue, OrderNumber = stationOrder
                    };
                    var result = manageStationLines.CreateStationLine(stationLine);

                    if (result > 0)
                    {
                        MessageBox.Show($"Station Line mapping {StationLineMappingText()} added success.", "Add station line", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        DataGridBinding();
                        Clear();
                        return;
                    }

                    MessageBox.Show($"Station Line mapping {StationLineMappingText()} could not added.", "Add station line", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(ex.Message, "Add station line", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (InvalidOperationException ex)
            {
                MessageBox.Show(ex.Message, "Add station line", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception)
            {
                MessageBox.Show("Oops! Something went wrong.", "Add station line error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #9
0
        public void SeedStations()
        {
            List <Station>     stations8 = new List <Station>();
            List <Station>     stations4 = new List <Station>();
            List <StationLine> stlines8  = new List <StationLine>();
            List <StationLine> stlines4  = new List <StationLine>();
            Line lines8 = new Line();
            Line lines4 = new Line();

            if (!_context.Stations.Any())
            {
                Station station = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21000",
                        Street = "Bulevar Jovana Ducica"
                    },
                    Location = new Location()
                    {
                        X = 45.248643,
                        Y = 19.792551
                    },
                    Name = "Okretnica 8-ce"
                };

                _context.Add(station);
                stations8.Add(station);

                Station station2 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21000",
                        Street = "Bulevar Kneza Milosa"
                    },
                    Location = new Location()
                    {
                        X = 45.250305,
                        Y = 19.791516
                    },
                    Name = "Okretnica 8-ce"
                };

                _context.Add(station2);
                stations8.Add(station2);

                Station station3 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21000",
                        Street = "Bulevar Kneza Milosa"
                    },
                    Location = new Location()
                    {
                        X = 45.253440,
                        Y = 19.789697
                    },
                    Name = "Okretnica 8-ce"
                };

                _context.Add(station3);
                stations8.Add(station3);

                Station station4 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21000",
                        Street = "Bulevar Kneza Milosa"
                    },
                    Location = new Location()
                    {
                        X = 45.255003,
                        Y = 19.794144
                    },
                    Name = "Okretnica 8-ce"
                };

                _context.Add(station4);
                stations8.Add(station4);

                Station station5 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21000",
                        Street = "Bulevar Kneza Milosa"
                    },
                    Location = new Location()
                    {
                        X = 45.251204,
                        Y = 19.796821
                    },
                    Name = "Okretnica 8-ce"
                };

                _context.Add(station5);
                stations8.Add(station5);

                Station station6 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21000",
                        Street = "Bulevar Kneza Milosa"
                    },
                    Location = new Location()
                    {
                        X = 45.251023,
                        Y = 19.798561
                    },
                    Name = "Okretnica 8-ce"
                };

                _context.Add(station6);
                stations8.Add(station6);

                Station station7 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21000",
                        Street = "Bulevar Kneza Milosa"
                    },
                    Location = new Location()
                    {
                        X = 45.254104,
                        Y = 19.807508
                    },
                    Name = "Okretnica 8-ce"
                };

                _context.Add(station7);
                stations8.Add(station7);

                Station station8 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21000",
                        Street = "Bulevar Kneza Milosa"
                    },
                    Location = new Location()
                    {
                        X = 45.257155,
                        Y = 19.816241
                    },
                    Name = "Okretnica 8-ce"
                };

                _context.Add(station8);
                stations8.Add(station8);

                Station station9 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21000",
                        Street = "Bulevar Kneza Milosa"
                    },
                    Location = new Location()
                    {
                        X = 45.258862,
                        Y = 19.822775
                    },
                    Name = "Okretnica 8-ce"
                };

                _context.Add(station9);
                stations8.Add(station9);

                Station station10 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21000",
                        Street = "Bulevar Kneza Milosa"
                    },
                    Location = new Location()
                    {
                        X = 45.260678,
                        Y = 19.833057
                    },
                    Name = "Okretnica 8-ce"
                };

                _context.Add(station10);
                stations8.Add(station10);

                Station station11 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21000",
                        Street = "Bulevar Kneza Milosa"
                    },
                    Location = new Location()
                    {
                        X = 45.262600,
                        Y = 19.839689
                    },
                    Name = "Okretnica 8-ce"
                };

                _context.Add(station11);
                stations8.Add(station11);

                Station station12 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21000",
                        Street = "Jovana Subotica"
                    },
                    Location = new Location()
                    {
                        X = 45.260318,
                        Y = 19.842785
                    },
                    Name = "Okretnica 8-ce"
                };

                _context.Add(station12);
                stations8.Add(station12);

                Station station13 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21000",
                        Street = "Bulevar Kneza Milosa"
                    },
                    Location = new Location()
                    {
                        X = 45.256089,
                        Y = 19.841208
                    },
                    Name = "Okretnica 8-ce"
                };

                _context.Add(station13);
                stations8.Add(station13);

                Station station14 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21000",
                        Street = "Bulevar Kneza Milosa"
                    },
                    Location = new Location()
                    {
                        X = 45.253385,
                        Y = 19.843214
                    },
                    Name = "Okretnica 8-ce"
                };

                _context.Add(station14);
                stations8.Add(station14);

                Station station15 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21000",
                        Street = "Bulevar Kneza Milosa"
                    },
                    Location = new Location()
                    {
                        X = 45.253521,
                        Y = 19.847516
                    },
                    Name = "Okretnica 8-ce"
                };

                _context.Add(station15);
                stations8.Add(station15);

                Station station16 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21000",
                        Street = "Bulevar Kneza Milosa"
                    },
                    Location = new Location()
                    {
                        X = 45.251270,
                        Y = 19.846840
                    },
                    Name = "Okretnica 8-ce"
                };

                _context.Add(station16);
                stations8.Add(station16);

                Station station17 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21000",
                        Street = "Bulevar Kneza Milosa"
                    },
                    Location = new Location()
                    {
                        X = 45.247750,
                        Y = 19.849104
                    },
                    Name = "Okretnica 8-ce"
                };

                _context.Add(station17);
                stations8.Add(station17);

                Station station18 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21000",
                        Street = "Bulevar Kneza Milosa"
                    },
                    Location = new Location()
                    {
                        X = 45.245620,
                        Y = 19.846819
                    },
                    Name = "Okretnica 8-ce"
                };

                _context.Add(station18);
                stations8.Add(station18);

                Station station19 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21000",
                        Street = "Bulevar Kneza Milosa"
                    },
                    Location = new Location()
                    {
                        X = 45.238989,
                        Y = 19.847967
                    },
                    Name = "Okretnica 8-ce"
                };

                _context.Add(station19);
                stations8.Add(station19);

                //stations 4

                Station station20 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21101",
                        Street = "Bulevar Jase Tomica"
                    },
                    Location = new Location()
                    {
                        X = 45.26446733929329,
                        Y = 19.829593939230563
                    },
                    Name = "Zeleznicka stanica"
                };

                _context.Add(station20);
                stations4.Add(station20);

                Station station21 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21101",
                        Street = "Bulevar oslobodjenja 30"
                    },
                    Location = new Location()
                    {
                        X = 45.26001187717833,
                        Y = 19.832297605917574
                    },
                    Name = "Lutrija"
                };

                _context.Add(station21);
                stations4.Add(station21);

                Station station22 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21101",
                        Street = "Bulevar oslobodjenja 66a"
                    },
                    Location = new Location()
                    {
                        X = 45.25462227539901,
                        Y = 19.83525958562143
                    },
                    Name = "Aleksandar zgrada"
                };

                _context.Add(station22);
                stations4.Add(station22);

                Station station23 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21101",
                        Street = "Jevrejska 31"
                    },
                    Location = new Location()
                    {
                        X = 45.25158042895487,
                        Y = 19.83682571728548
                    },
                    Name = "Futoska pijaca"
                };

                _context.Add(station23);
                stations4.Add(station23);

                Station station24 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21101",
                        Street = "Centar"
                    },
                    Location = new Location()
                    {
                        X = 45.25390672021402,
                        Y = 19.842361796692217
                    },
                    Name = "Lili"
                };

                _context.Add(station24);
                stations4.Add(station24);

                Station station25 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21101",
                        Street = "Centar"
                    },
                    Location = new Location()
                    {
                        X = 45.25318165264042,
                        Y = 19.84401403744539
                    },
                    Name = "Bazar"
                };

                _context.Add(station25);
                stations4.Add(station25);

                Station station26 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21101",
                        Street = "Bulevar Jase Tomica"
                    },
                    Location = new Location()
                    {
                        X = 45.2534938719465,
                        Y = 19.84743306299697
                    },
                    Name = "Zeleznicka stanica"
                };

                _context.Add(station26);
                stations4.Add(station26);

                Station station27 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21101",
                        Street = "Bulevar Jase Tomica"
                    },
                    Location = new Location()
                    {
                        X = 45.25122798857049,
                        Y = 19.846853705849753
                    },
                    Name = "Zeleznicka stanica"
                };

                _context.Add(station27);
                stations4.Add(station27);

                Station station28 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21101",
                        Street = "Strazilovska"
                    },
                    Location = new Location()
                    {
                        X = 45.247753458479686,
                        Y = 19.84917113443862
                    },
                    Name = "Strazilovska"
                };

                _context.Add(station28);
                stations4.Add(station28);

                Station station29 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21101",
                        Street = "Izvor, Bulevar Cara Lazara"
                    },
                    Location = new Location()
                    {
                        X = 45.24551257269078,
                        Y = 19.846830790917465
                    },
                    Name = "Izvor"
                };

                _context.Add(station29);
                stations4.Add(station29);

                Station station30 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21101",
                        Street = "Narodnog fronta 1"
                    },
                    Location = new Location()
                    {
                        X = 45.24253627573835,
                        Y = 19.84749597875316
                    },
                    Name = "Zeleznicka stanica"
                };

                _context.Add(station30);
                stations4.Add(station30);

                Station station31 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21101",
                        Street = "Narodnog fronta"
                    },
                    Location = new Location()
                    {
                        X = 45.24037140396024,
                        Y = 19.837623919236535
                    },
                    Name = "Narodnog fronta"
                };

                _context.Add(station31);
                stations4.Add(station31);

                Station station32 = new Station()
                {
                    Address = new Address()
                    {
                        City   = "Novi Sad",
                        Number = "21101",
                        Street = "Narodnog fronta"
                    },
                    Location = new Location()
                    {
                        X = 45.237289068480194,
                        Y = 19.826809252488488
                    },
                    Name = "Narodnog fronta"
                };

                _context.Add(station32);
                stations4.Add(station32);
            }

            if (!_context.StationLines.Any())
            {
                foreach (Station s in stations8)
                {
                    StationLine stline = new StationLine()
                    {
                        Station = s
                    };
                    _context.Add(stline);
                    stlines8.Add(stline);
                }

                foreach (Station s in stations4)
                {
                    StationLine stline = new StationLine()
                    {
                        Station = s
                    };
                    _context.Add(stline);
                    stlines4.Add(stline);
                }
            }


            if (!_context.Lines.Any())
            {
                Line line8 = new Line()
                {
                    Name       = "NOVO NASELJE - CENTAR - LIMAN 4",
                    LineNumber = 8,
                    Buses      = new List <Bus>()
                    {
                        new Bus()
                        {
                            BusNumber = 244,
                            InUse     = true,
                        },
                        new Bus()
                        {
                            BusNumber = 222,
                            InUse     = true,
                        },
                        new Bus()
                        {
                            BusNumber = 234,
                            InUse     = true,
                        }
                    },
                    Stations = stlines8
                };
                _context.Add(line8);
                lines8 = line8;

                Line line4 = new Line()
                {
                    Name       = "ZELEZNICKA STANICA - CENTAR - LIMAN 4",
                    LineNumber = 4,
                    Buses      = new List <Bus>()
                    {
                        new Bus()
                        {
                            BusNumber = 135,
                            InUse     = true,
                        },
                        new Bus()
                        {
                            BusNumber = 789,
                            InUse     = true,
                        },
                        new Bus()
                        {
                            BusNumber = 354,
                            InUse     = true,
                        }
                    },
                    Stations = stlines4
                };
                _context.Add(line4);
                lines4 = line4;
            }

            if (!_context.TimeTables.Any())
            {
                TimeTable timeTable1 = new TimeTable()
                {
                    Day        = "Working day",
                    Departures = "00:12-22-25-34-40-45-58-/01:30-/02:30-/03:30-/04:30-/05:30-/06:00-20-40-/07:03-12-23-30-45-58-/08:13-22-25-30-45-58-/09:03-12-23-30-45-58-/10:03-12-23-30-45-58-/11:03-12-23-30-45-58-/12:03-12-23-30-45-58-/13:03-12-23-30-45-58-/14:03-12-23-30-45-58-/15:03-12-23-30-45-58-/16:03-12-23-30-45-58-/17:00-23-30-40-58-/18:00-23-30-40-58-/19:00-23-30-40-58-/20:00-23-40-58-/21:00-23-40-58-/22:00-23-40-58-/23:00-30-58-/",
                    Type       = "In City",
                    Line       = lines8,
                    LineId     = lines8.Id
                };
                _context.Add(timeTable1);

                TimeTable timeTable2 = new TimeTable()
                {
                    Day        = "Working day",
                    Departures = "00:12-25-34-40-45-58-/01:30-/02:30-/03:30-/04:30-/05:30-/06:00-25-40-/07:03-14-23-37-45-52-/08:13-22-25-30-45-58-/09:03-12-30-45-58-/10:03-12-27-30-41-58-/11:03-12-23-30-45-58-/12:03-12-23-30-45-58-/13:03-12-23-30-45-58-/14:03-12-23-30-45-58-/15:03-12-23-30-45-58-/16:03-12-23-30-45-58-/17:00-23-30-40-58-/18:00-23-30-40-58-/19:00-23-30-40-58-/20:00-23-40-58-/21:00-23-40-58-/22:00-23-40-58-/23:00-30-58-/",
                    Type       = "In City",
                    Line       = lines4,
                    LineId     = lines4.Id
                };
                _context.Add(timeTable2);
            }

            if (!_context.PricelistItems.Any())
            {
                UserDiscount ud1 = new UserDiscount()
                {
                    Type  = "Student",
                    Value = 20
                };
                _context.Add(ud1);

                UserDiscount ud2 = new UserDiscount()
                {
                    Type  = "Regular",
                    Value = 0
                };
                _context.Add(ud2);

                UserDiscount ud3 = new UserDiscount()
                {
                    Type  = "Senior",
                    Value = 35
                };
                _context.Add(ud3);


                Item it1 = new Item()
                {
                    Type        = "Hourly",
                    Description = "This ticket is valid just for one hour"
                };
                _context.Add(it1);

                Item it2 = new Item()
                {
                    Type        = "Daily",
                    Description = "This ticket is valid until 00:00 next day"
                };
                _context.Add(it2);


                Item it3 = new Item()
                {
                    Type        = "Monthly",
                    Description = "This ticket is valid for one month"
                };
                _context.Add(it3);

                Item it4 = new Item()
                {
                    Type        = "Annual",
                    Description = "This ticket is valid for one year"
                };
                _context.Add(it4);
                _context.SaveChanges();

                Pricelist pr = new Pricelist()
                {
                    Active = true,
                    From   = DateTime.Now,
                    To     = DateTime.Now.AddMonths(4)
                };
                _context.Add(pr);
                _context.SaveChanges();

                PricelistItem prit1 = new PricelistItem()
                {
                    Pricelist = pr,
                    Price     = 150,
                    Item      = it1
                };
                _context.Add(prit1);

                PricelistItem prit2 = new PricelistItem()
                {
                    Pricelist = pr,
                    Price     = 390,
                    Item      = it2
                };
                _context.Add(prit2);

                PricelistItem prit3 = new PricelistItem()
                {
                    Pricelist = pr,
                    Price     = 3450,
                    Item      = it3
                };
                _context.Add(prit3);

                PricelistItem prit4 = new PricelistItem()
                {
                    Pricelist = pr,
                    Price     = 12050,
                    Item      = it4
                };
                _context.Add(prit4);
            }

            _context.SaveChanges();
        }
        protected override void Seed(WebApp.Persistence.ApplicationDbContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data.

            if (!context.Roles.Any(r => r.Name == "Admin"))
            {
                var store   = new RoleStore <IdentityRole>(context);
                var manager = new RoleManager <IdentityRole>(store);
                var role    = new IdentityRole {
                    Name = "Admin"
                };

                manager.Create(role);
            }

            if (!context.Roles.Any(r => r.Name == "Controller"))
            {
                var store   = new RoleStore <IdentityRole>(context);
                var manager = new RoleManager <IdentityRole>(store);
                var role    = new IdentityRole {
                    Name = "Controller"
                };

                manager.Create(role);
            }

            if (!context.Roles.Any(r => r.Name == "AppUser"))
            {
                var store   = new RoleStore <IdentityRole>(context);
                var manager = new RoleManager <IdentityRole>(store);
                var role    = new IdentityRole {
                    Name = "AppUser"
                };

                manager.Create(role);
            }

            var userStore   = new UserStore <ApplicationUser>(context);
            var userManager = new UserManager <ApplicationUser>(userStore);

            if (!context.Users.Any(u => u.UserName == "*****@*****.**"))
            {
                var user = new ApplicationUser()
                {
                    Id = "admin", UserName = "******", Email = "*****@*****.**", PasswordHash = ApplicationUser.HashPassword("Admin123!"), EmailConfirmed = true
                };
                userManager.Create(user);
                userManager.AddToRole(user.Id, "Admin");
            }

            if (!context.Users.Any(u => u.UserName == "*****@*****.**"))
            {
                var user = new ApplicationUser()
                {
                    Id = "appu", UserName = "******", Email = "*****@*****.**", PasswordHash = ApplicationUser.HashPassword("Appu123!"), Type = "Regular", EmailConfirmed = true, PhoneNumber = "111111", PhoneNumberConfirmed = true, Status = "Approved", Active = true
                };
                userManager.Create(user);
                userManager.AddToRole(user.Id, "AppUser");
            }

            if (!context.Users.Any(u => u.UserName == "*****@*****.**"))
            {
                var user = new ApplicationUser()
                {
                    Id = "contr", UserName = "******", Email = "*****@*****.**", PasswordHash = ApplicationUser.HashPassword("Controller123!"), EmailConfirmed = true
                };
                userManager.Create(user);
                userManager.AddToRole(user.Id, "Controller");
            }

            if (!context.PriceLists.Any(u => u.Id == "Temporal"))
            {
                var pricelist = new PriceList()
                {
                    Id = "Temporal", Price = 70
                };
                context.PriceLists.Add(pricelist);
            }
            if (!context.PriceLists.Any(u => u.Id == "Day"))
            {
                var pricelist = new PriceList()
                {
                    Id = "Day", Price = 200
                };
                context.PriceLists.Add(pricelist);
            }

            if (!context.PriceLists.Any(u => u.Id == "Month"))
            {
                var pricelist = new PriceList()
                {
                    Id = "Month", Price = 1500
                };
                context.PriceLists.Add(pricelist);
            }

            if (!context.PriceLists.Any(u => u.Id == "Year"))
            {
                var pricelist = new PriceList()
                {
                    Id = "Year", Price = 10000
                };
                context.PriceLists.Add(pricelist);
            }

            if (context.Lines.Count() == 0)
            {
                var line = new Line()
                {
                    Id = 5, Name = "5"
                };
                var line2 = new Line()
                {
                    Id = 35, Name = "35"
                };

                context.Lines.Add(line);
                context.Lines.Add(line2);

                var station1 = new Station()
                {
                    Id = 1, Name = "5A", Address = "Житни трг 11, Нови Сад, Србија", CoordinateX = 45.258872917776692, CoordinateY = 19.83649953183367, LineId = "5"
                };
                var station2 = new Station()
                {
                    Id = 2, Name = "5B", Address = "Богдана Гарабантина 7, Нови Сад 21000, Србија", CoordinateX = 45.257350399443482, CoordinateY = 19.825753529243503, LineId = "5"
                };
                var station3 = new Station()
                {
                    Id = 3, Name = "5C", Address = "Хајдук Вељкова 8, Нови Сад 21000, Србија", CoordinateX = 45.2503897918017, CoordinateY = 19.824792225139664, LineId = "5"
                };
                var station4 = new Station()
                {
                    Id = 4, Name = "5D", Address = "Булевар цара Лазара 122, Нови Сад 21000, Србија", CoordinateX = 45.240164852074031, CoordinateY = 19.826062518936215, LineId = "5"
                };
                var station5 = new Station()
                {
                    Id = 5, Name = "5E", Address = "Булевар цара Лазара 25BB, Нови Сад 21000, Србија", CoordinateX = 45.242993212430456, CoordinateY = 19.83849080223472, LineId = "5"
                };

                var station21 = new Station()
                {
                    Id = 6, Name = "35A", Address = "Булевар краља Петра I 21, Нови Сад 21000, Србија", CoordinateX = 45.259839575597304, CoordinateY = 19.830319721608522, LineId = "35"
                };
                var station22 = new Station()
                {
                    Id = 7, Name = "35B", Address = "Карађорђева 4, Нови Сад, Србија", CoordinateX = 45.26266695635961, CoordinateY = 19.840173083597893, LineId = "35"
                };
                var station23 = new Station()
                {
                    Id = 8, Name = "35C", Address = "Ђорђа Радујкова 3, Нови Сад, Србија", CoordinateX = 45.267427270041978, CoordinateY = 19.80693943997203, LineId = "35"
                };
                var station24 = new Station()
                {
                    Id = 9, Name = "35D", Address = "Булевар војводе Степе 49, Нови Сад, Србија", CoordinateX = 45.255755337504681, CoordinateY = 19.797566727742652, LineId = "35"
                };


                context.Stations.Add(station1);
                context.Stations.Add(station2);
                context.Stations.Add(station3);
                context.Stations.Add(station4);
                context.Stations.Add(station5);

                context.Stations.Add(station21);
                context.Stations.Add(station22);
                context.Stations.Add(station23);
                context.Stations.Add(station24);

                var stationLine1 = new StationLine()
                {
                    Id = 1, StationId = 1, LineId = 5
                };
                var stationLine2 = new StationLine()
                {
                    Id = 2, StationId = 2, LineId = 5
                };
                var stationLine3 = new StationLine()
                {
                    Id = 3, StationId = 3, LineId = 5
                };
                var stationLine4 = new StationLine()
                {
                    Id = 4, StationId = 4, LineId = 5
                };
                var stationLine5 = new StationLine()
                {
                    Id = 5, StationId = 5, LineId = 5
                };

                var stationLine21 = new StationLine()
                {
                    Id = 6, StationId = 6, LineId = 35
                };
                var stationLine22 = new StationLine()
                {
                    Id = 7, StationId = 7, LineId = 35
                };
                var stationLine23 = new StationLine()
                {
                    Id = 8, StationId = 8, LineId = 35
                };
                var stationLine24 = new StationLine()
                {
                    Id = 9, StationId = 9, LineId = 35
                };

                context.StationLines.Add(stationLine1);
                context.StationLines.Add(stationLine2);
                context.StationLines.Add(stationLine3);
                context.StationLines.Add(stationLine4);
                context.StationLines.Add(stationLine5);

                context.StationLines.Add(stationLine21);
                context.StationLines.Add(stationLine22);
                context.StationLines.Add(stationLine23);
                context.StationLines.Add(stationLine24);
            }
            if (context.TimeTables.Count() == 0)
            {
                var timetable = new TimeTable {
                    Id = "247dff98-e950-4001-a124-3abc81d09426", Day = "Weekday", LineId = "5", Times = "6:20;7:25;9:45;11:45;13:25;15:20;17:50;", Type = "City"
                };
                context.TimeTables.Add(timetable);
            }
        }
 public virtual bool Equals(StationLine other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return other.StationId == StationId && other.LineId == LineId;
 }