Ejemplo n.º 1
0
        public int AddStation(StationVm station)
        {
            var stationRepo = _repository;
            var stationId   = stationRepo.AddStation(station);

            return(stationId);
        }
Ejemplo n.º 2
0
        public void GetStations()
        {
            //Arrange
            var controller = new StationController(new StationService(new StationRepositoryStub()));

            var expected = new List <StationVm>();
            var Stations = new StationVm()
            {
                StationId   = 0,
                StationName = "Stavanger",
            };

            expected.Add(Stations);
            expected.Add(Stations);
            expected.Add(Stations);

            // Act
            var actionResult = (ViewResult)controller.Index();
            var result       = (List <StationVm>)actionResult.Model;

            //Assert
            Assert.AreEqual(actionResult.ViewName, "");

            for (var i = 0; i < result.Count; i++)
            {
                Assert.AreEqual(expected[i].StationId, result[i].StationId);
                Assert.AreEqual(expected[i].StationName, result[i].StationName);
            }
        }
Ejemplo n.º 3
0
        public List <StationVm> GetStationsByName(string searchterm)
        {
            var stations = new List <StationVm>();
            var station1 = new StationVm()
            {
                StationId   = 1,
                StationName = "Sandnes"
            };
            var station2 = new StationVm()
            {
                StationId   = 2,
                StationName = "Egersund"
            };
            var station3 = new StationVm()
            {
                StationId   = 3,
                StationName = "Audnedal"
            };

            stations.Add(station1);
            stations.Add(station2);
            stations.Add(station3);

            return(stations);
        }
Ejemplo n.º 4
0
        public ActionResult UpdateStation(StationVm station)
        {
            var stationSer = _StationBLL;

            stationSer.UpdateStation(station);

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 5
0
        public ActionResult AddStation(StationVm station)
        {
            var stationService = _StationBLL;

            stationService.AddStation(station);

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 6
0
        public int AddStation(StationVm stationVm)
        {
            var station = new Station
            {
                StationName = "Bergen",
                Id          = 18,
            };

            return(station.Id);
        }
Ejemplo n.º 7
0
        public StationVm GetStation(int id)
        {
            var station = new StationVm()
            {
                StationId   = 0,
                StationName = "Stavanger",
            };

            return(station);
        }
Ejemplo n.º 8
0
        public void UpdateStation(StationVm stationEdit)
        {
            using (Oblig1Context db = new Oblig1Context())
            {
                var stationDb = db.Stations.Where(a => a.Id == stationEdit.StationId).FirstOrDefault();

                stationDb.StationName = stationEdit.StationName;
                db.SaveChanges();
            }
        }
Ejemplo n.º 9
0
        public List <StationVm> GetStations()
        {
            var StationList = new List <StationVm>();
            var Stations    = new StationVm()
            {
                StationId   = 0,
                StationName = "Stavanger",
            };

            StationList.Add(Stations);
            StationList.Add(Stations);
            StationList.Add(Stations);
            return(StationList);
        }
Ejemplo n.º 10
0
        public int AddStation(StationVm stationVm)
        {
            var station = new Station
            {
                StationName = stationVm.StationName
            };

            using (Oblig1Context db = new Oblig1Context())
            {
                db.Stations.Add(station);
                db.SaveChanges();
            }

            return(station.Id);
        }
Ejemplo n.º 11
0
        public static BaseViewModelMain GetView(string s)
        {
            BaseViewModelMain viewContent = null;

            switch (s)
            {
            case "Control": viewContent = new ControlVm(); break;

            case "Report": viewContent = new ReportVm(); break;

            case "Route": viewContent = new RouteVm(); break;

            case "Train": viewContent = new TrainVm(); break;

            case "Station": viewContent = new StationVm(); break;

            case "PinLocation": viewContent = new PinLocationVm(); break;

            case "TimeTable": viewContent = new TimeTableVm(); break;

            case "User": viewContent = new UserVm(); break;
            }
            return(viewContent);
        }
Ejemplo n.º 12
0
 public void UpdateStation(StationVm stationEdit)
 {
 }
Ejemplo n.º 13
0
        public void UpdateStation(StationVm station)
        {
            var stationRepo = _repository;

            stationRepo.UpdateStation(station);
        }