Пример #1
0
        string IService.SaveMarker(string latitude, string longitude, string city, string comment, string type)
        {
            try
            {
                using (var ctx = new igodbEntities())
                {
                    MARKER marker = new MARKER();
                    marker.CITY = city;
                    marker.COMMENT = comment;
                    marker.LATITUDE = latitude;
                    marker.LONGITUDE = longitude;
                    marker.TYPE = type;
                    marker.CREATED_DATE = DateTime.Now;

                    ctx.MARKERS.Add(marker);
                    ctx.SaveChanges();

                    return "ok";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        JArray IService.GetMakers(string city)
        {
            try
            {
                List<MarkersModel> markers = new List<MarkersModel>();

                using (var ctx = new igodbEntities())
                {
                    markers = (from i in ctx.MARKERS
                                 where i.CITY == city
                                 select new MarkersModel()
                                 {
                                     City = i.CITY,
                                     Comment = i.COMMENT,
                                     Latitude = i.LATITUDE,
                                     Longitude = i.LONGITUDE,
                                     Type = i.TYPE
                                 }).ToList();

                    return JArray.FromObject(markers);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }