public IActionResult CreateLandMark([FromBody]MarkerAndText landMark) { user = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.Name).Value; var obj = landMark;//JsonConvert.DeserializeObject<LandMark>(landMark.ToString()); if (obj != null) { int result = _landMarkAndNotesManager.CreateLandMark(obj.longitude, obj.latitude, landMark.userId,landMark.text); return Ok(new { status = result }); } return Ok(new { status = "false" }); }
public bool UpdateLandMarkNote(MarkerAndText markerAndText) { try { LandMarkNote landmark = _detaRepository.GetLandMark(markerAndText.id); landmark.Latitude = markerAndText.latitude; landmark.Longitude = markerAndText.longitude; landmark.UserNote = markerAndText.text; return(_detaRepository.UpdateLandMark(landmark) > 0); } catch (Exception ex) { return(false); } }
public List <MarkerAndText> GetAllLandmarks(string userId) { List <LandMarkNote> markers = _detaRepository.GetAllLandMarks(); List <MarkerAndText> returnMarkers = new List <MarkerAndText>(); foreach (LandMarkNote m in markers) { MarkerAndText markerAndText = new MarkerAndText(); markerAndText.id = m.Id; markerAndText.latitude = m.Latitude; markerAndText.longitude = m.Longitude; markerAndText.text = m.UserNote; markerAndText.userId = m.User.Id; markerAndText.userName = m.User.Username; returnMarkers.Add(markerAndText); } return(returnMarkers); }
public List <MarkerAndText> search(string searchText) { if (searchText == "all") { searchText = ""; } List <LandMarkNote> markers = _detaRepository.searchLandMarks(searchText); List <MarkerAndText> returnMarkers = new List <MarkerAndText>(); foreach (LandMarkNote m in markers) { MarkerAndText markerAndText = new MarkerAndText(); markerAndText.id = m.Id; markerAndText.latitude = m.Latitude; markerAndText.longitude = m.Longitude; markerAndText.text = m.UserNote; markerAndText.userId = m.User.Id; markerAndText.userName = m.User.Username; returnMarkers.Add(markerAndText); } return(returnMarkers); }
public bool UpdateLandMarkNote([FromBody]MarkerAndText model) { user = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.Name).Value; return _landMarkAndNotesManager.UpdateLandMarkNote(model); }