public void PlaceServiceGet_PlaceId_ReturnsPlaceDto() { // Arrange int placeId = 1; //var mapperMock = new Mock<IMappingAction<Place,PlaceDto>>(); //var mapperMock2 = new Mock<IObjectMapper>(); //var mapperMock2 = new Mock<IMapper>(); // mapperMock2.Setup(m => m.Map<Place, PlaceDto>(It.IsAny<Place>())).Returns(new PlaceDto()); var uowMock = new Mock <IUnitOfWork>(); uowMock.Setup(u => u.Places.Add(new Place { Id = 1, Name = "Kharkiv railway station" })); uowMock.Setup(u => u.Places.Get(placeId)).Returns(new Place { Name = "Kharkiv railway station" }); var placeService = new PlaceService(uowMock.Object); // Act var placeDto = placeService.Get(placeId); // Assert //Assert.IsNotNull(placeDto); //uowMock.Verify(a => a.Places.Get(placeId), Times.Exactly(2)); Assert.AreEqual("Kharkiv railway station", placeDto.Name); }
private async Task DeleteItemsAsync(IEnumerable <PlaceModel> models) { foreach (var model in models) { await PlaceService.DeletePlaceAsync(model); } }
public async Task LoadAsync(PlaceDetailsArgs args) { ViewModelArgs = args ?? PlaceDetailsArgs.CreateDefault(); if (ViewModelArgs.IsNew) { Item = new PlaceModel(); Item = await PlaceService.CreateNewPlaceAsync(ViewModelArgs.CustomerID); IsEditMode = true; } else { try { var item = await PlaceService.GetPlaceAsync(ViewModelArgs.PlaceID); Item = item ?? new PlaceModel { PlaceID = ViewModelArgs.PlaceID, IsEmpty = true }; } catch (Exception ex) { LogException("Place", "Load", ex); } } }
private List <Entities.UserInRegion> GetListUserInRegion(int regionNum, Application2016.Areas.Admin.Models.ListUserInRegionModel listUir) { PlaceService placeService = new PlaceService(); List <Entities.UserInRegion> result = new List <Entities.UserInRegion>(); Entities.UserInRegion uir; int[] arrCity = listUir.region_city; int[] arrDistrict = listUir.region_district; int[] arrWard = listUir.region_ward; for (int i = 0; i < regionNum; i++) { uir = new UserInRegion(); uir.ListCity = placeService.ListPlaceItemByParent(0); uir.ListDistrict = new List <Item>(); uir.ListWard = new List <Item>(); if (arrCity != null) { uir.CityId = arrCity[i]; uir.DistrictId = arrDistrict[i]; uir.WardId = arrWard[i]; if (arrCity[i] > 0) { uir.ListDistrict = placeService.ListPlaceItemByParent(arrCity[i]); } if (arrDistrict[i] > 0) { uir.ListWard = placeService.ListPlaceItemByParent(arrDistrict[i]); } } result.Add(uir); } return(result); }
public JsonResult ListPlaceByRegion(int regionId) { PlaceService placeService = new PlaceService(); List <Entities.Item> lstEntity = placeService.ListPlaceItemOfRegion(regionId); return(Json(lstEntity)); }
public JsonResult ListPlaceByRegions(int[] regionIds) { PlaceService placeService = new PlaceService(); List <Entities.Item> allEntity = new List <Entities.Item>(); if (regionIds != null) { List <Entities.Item> lstEntity; foreach (int regionId in regionIds) { lstEntity = placeService.ListPlaceItemOfRegion(regionId); if (lstEntity.Count > 0) { allEntity.AddRange(lstEntity); } } allEntity.Insert(0, new Entities.Item() { Id = 0, Text = "" }); return(Json(allEntity)); } return(Json(allEntity)); }
public ActionResult EditPlace(ParkingPlace aPlace) { PlaceService service = new PlaceService(); service.editPlace(aPlace, 10); return(RedirectToAction("index", "Owner")); }
/// <summary> /// Maps the services. /// </summary> /// <param name="csdServices">The CSD services.</param> /// <returns>Returns a list of place services.</returns> private static IEnumerable <PlaceService> MapServices(IEnumerable <service> csdServices) { // TODO: implement return(new List <PlaceService>()); var placeServiceService = ApplicationContext.Current.GetService <IDataPersistenceService <PlaceService> >(); var services = new List <PlaceService>(); foreach (var csdService in csdServices) { var service = new PlaceService(); Guid key; //service.Key = !TryMapKey(csdService.entityID, out key) ? Guid.NewGuid() : key; // map service concept if (csdService.codedType?.Any() == true) { // we don't support multiple service types for a place service at the moment, so we only take the first one service.ServiceConceptKey = MapCodedType(csdService.codedType[0].code, csdService.codedType[0].codingScheme)?.Key; } services.Add(service); } return(services); }
public async Task <List <Tracking_PlaceDTO> > FilterListPlace([FromBody] Tracking_PlaceFilterDTO Tracking_PlaceFilterDTO) { if (!ModelState.IsValid) { throw new BindException(ModelState); } PlaceFilter PlaceFilter = new PlaceFilter(); PlaceFilter.Skip = 0; PlaceFilter.Take = 20; PlaceFilter.OrderBy = PlaceOrder.Id; PlaceFilter.OrderType = OrderType.ASC; PlaceFilter.Selects = PlaceSelect.ALL; PlaceFilter.Id = Tracking_PlaceFilterDTO.Id; PlaceFilter.Name = Tracking_PlaceFilterDTO.Name; PlaceFilter.PlaceGroupId = Tracking_PlaceFilterDTO.PlaceGroupId; PlaceFilter.Radius = Tracking_PlaceFilterDTO.Radius; PlaceFilter.Latitude = Tracking_PlaceFilterDTO.Latitude; PlaceFilter.Longtitude = Tracking_PlaceFilterDTO.Longtitude; List <Place> Places = await PlaceService.List(PlaceFilter); List <Tracking_PlaceDTO> Tracking_PlaceDTOs = Places .Select(x => new Tracking_PlaceDTO(x)).ToList(); return(Tracking_PlaceDTOs); }
public PartialViewResult Update(int id = 0, int cityId = -1, int districtId = -1, int wardId = -1, int regionId = -1) { PlaceService placeService = new PlaceService(); RegionService regionService = new RegionService(); Models.Road_VillageModel m = new Models.Road_VillageModel(); if (id > 0) { var road = roadService.GetById(id); m.MapFrom(road, ref m); m.DistrictId = placeService.GetParentItem(m.WardId).Id; m.CityId = placeService.GetParentItem(m.DistrictId).Id; cityId = m.CityId; districtId = m.DistrictId; wardId = m.WardId; } m.ListCity = placeService.ListPlaceItemByParent(0); m.ListDistrict = placeService.ListPlaceItemByParent(cityId); m.ListWard = placeService.ListPlaceItemByParent(districtId); m.ListRegion = regionService.List(); LoadData(); ViewBag.ListRoad = roadService.ListItem(wardId, regionId); ViewBag.ActionForm = "Update"; return(PartialView("index", m)); }
public ActionResult Delete(int id) { PlaceService service = new PlaceService(); service.deletePlace(id); return(RedirectToAction("index", "Owner")); }
public TalkController(TalkService talkService, SpeakerService speakerService, CityService cityService, PlaceService placeService, AuthenticationProvider authenticationProvider) { _talkService = talkService; _speakerService = speakerService; _cityService = cityService; _placeService = placeService; _authenticationProvider = authenticationProvider; }
public string FindPlace() { var api = new PlaceService(); var place = api.GetPlace("MacDonalds", "-23.5512625", "-46.8563475", ""); return(place.Body); }
private Place[] GetTopAvailabilited() { PlaceService placeService = new PlaceService(); Place[] places = placeService.GetTopAvailabilited(10); return places; }
public SendNotificationViewModel() { var temp = new SendNotification(); temp.lstPlaces = PlaceService.GetPlaces(); temp.Sent = DateTime.Now; Notification = temp; }
private async Task DeleteRangesAsync(IEnumerable <IndexRange> ranges) { DataRequest <Place> request = BuildDataRequest(); foreach (var range in ranges) { await PlaceService.DeletePlaceRangeAsync(range.Index, range.Length, request); } }
private async Task <IList <PlaceModel> > GetItemsAsync() { if (!ViewModelArgs.IsEmpty) { DataRequest <Place> request = BuildDataRequest(); return(await PlaceService.GetPlacesAsync(request)); } return(new List <PlaceModel>()); }
private void PlaceComboBoxList() //Column 4 { var Pla = PlaceService.GetCity().Select(x => x.Street); foreach (var pla in Pla) { PlaceComboBox.Items.Add(pla); } }
public PlaceServiceTest() { var env = new Mock <IHostingEnvironment>(); var projectRootDirectory = Directory.GetParent(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName).FullName; env.Setup(m => m.ContentRootPath).Returns(projectRootDirectory); IPlaceRepository = new DummyPlaceRepository(env.Object); IPlaceService = new PlaceService(IPlaceRepository); }
public string DbChk() { PlaceService service = new PlaceService(); List <ParkingPlace> data = new List <ParkingPlace>(); data = service.getMatchedPlaces("AIUB"); return(data[0].SpotName.ToString()); }
private void PlaceComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { PlaceSetName.Text = PlaceService.GetPlace() .Where(x => (x.Street == PlaceComboBox.SelectedItem.ToString())) .Select(x => x.Street).FirstOrDefault().ToString(); PlaceSetName.Text = PlaceService.GetPlace() .Where(x => (x.Street == PlaceComboBox.SelectedItem.ToString())) .Select(x => x.PlacePopulation).FirstOrDefault().ToString(); }
public ActionResult MakeRequest(Booking book) { book.UserId = Convert.ToInt32(Session["USERID"]); book.IsPending = 1; PlaceService service = new PlaceService(); service.RequestPlace(book); return(RedirectToAction("index", "Users")); }
public ActionResult RegisterAgency2() { Application2016.Areas.Admin.Models.RegisterModel model = new Areas.Admin.Models.RegisterModel(); PlaceService placeService = new PlaceService(); // Lấy danh sách tỉnh. model.ListCity = placeService.ListPlaceItemByParent(0); return(PartialView("RegistryAgency2", model)); }
private async Task <IList <PlaceModel> > GetItems(string query) { var request = new DataRequest <Place>() { Query = query, OrderBy = r => r.place_id }; return(await PlaceService.GetPlacesAsync(0, 20, request)); }
public void InitLists() { SelectedTracks = new BindingList <Track>(NewStation.Tracks.ToList()); Places = new BindingList <Place>(PlaceService.GetAllPlaces()); AllTracks = new BindingList <Track>(TrackService.GetUnattachedTracks()); if (NewStation.IsValid()) { NewStation.Place = Places.First(x => x.Id == NewStation.Place.Id);//Necessary to init value in combo box properly } }
private void PlaceComboBoxList() //Column 4 { PlaceComboBox.Items.Clear(); var Pla = PlaceService.GetPlace().Where(x => x.CityModel.Id == Id_City).Select(x => x.Street); foreach (var pla in Pla) { PlaceComboBox.Items.Add(pla); } }
public JsonResult ListPlaceJson(int parentId) { PlaceService placeService = new PlaceService(); List <SelectListItem> lstEntity = placeService.ListItem(parentId); lstEntity.Insert(0, new SelectListItem { Value = "0", Text = "" }); return(Json(lstEntity)); }
public JsonResult SearchBlocks() { string Search = Request.Form["Search"]; List <PlaceDTO> places = PlaceService.GetAll() .Where(x => x.Name.ToLower().Contains(Search.ToLower()) || x.Tags.ToLower().Contains(Search.ToLower())) .OrderBy(x => x.Name).ToList(); return(Json(places)); }
public string getSearchItems(string id) { PlaceService service = new PlaceService(); List <ParkingPlace> matches = new List <ParkingPlace>(); matches = service.getMatchedPlaces(id); var jsonSerialiser = new JavaScriptSerializer(); var json = jsonSerialiser.Serialize(matches); return(json); }
public JsonResult ListPlaceJson(int parentId) { PlaceService placeService = new PlaceService(); List <Entities.Item> lstEntity = placeService.ListPlaceItemByParent(parentId); lstEntity.Insert(0, new Entities.Item() { Id = 0, Text = "" }); return(Json(lstEntity)); }
public PlaceControllerTest() { var hostingEnvironment = new Mock <IHostingEnvironment>(); var projectRootDirectory = Directory.GetParent(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName).FullName; hostingEnvironment.Setup(m => m.ContentRootPath).Returns(projectRootDirectory); IPlaceRepository = new DummyPlaceRepository(hostingEnvironment.Object); IPlaceService = new PlaceService(IPlaceRepository); IModelTransformer = new ModelTransformer(hostingEnvironment.Object); PlaceController = new PlaceController(IPlaceService, IModelTransformer); }
public ActionResult Login(FormCollection formCollection) { AccountService accountService = new AccountService(); Account auth = accountService.Authenticate(formCollection["user"], formCollection["pass"]); if (auth != null) { Session.Add("Account", auth); PlaceService placeService = new PlaceService(); Place[] places = placeService.GetRatedPlaceByAccount(auth.AccountID); return View("~/Views/Account/Dashboard.cshtml", places); } return View(); }
public LocationEventArgs(PlaceService.TransitPlace place) : this(place.Country, place.State, place.City, place.Neighborhood) { }