public int AddStation(StationVm station) { var stationRepo = _repository; var stationId = stationRepo.AddStation(station); return(stationId); }
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); } }
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); }
public ActionResult UpdateStation(StationVm station) { var stationSer = _StationBLL; stationSer.UpdateStation(station); return(RedirectToAction("Index")); }
public ActionResult AddStation(StationVm station) { var stationService = _StationBLL; stationService.AddStation(station); return(RedirectToAction("Index")); }
public int AddStation(StationVm stationVm) { var station = new Station { StationName = "Bergen", Id = 18, }; return(station.Id); }
public StationVm GetStation(int id) { var station = new StationVm() { StationId = 0, StationName = "Stavanger", }; return(station); }
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(); } }
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); }
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); }
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); }
public void UpdateStation(StationVm stationEdit) { }
public void UpdateStation(StationVm station) { var stationRepo = _repository; stationRepo.UpdateStation(station); }