public async Task <IEnumerable <Place> > GetEstablishments(double lat, double lon, double distance)
        {
            var location = new Geolocation
            {
                Latitude  = lat,
                Longitude = lon
            };
            var result = await _placesService.GetPlaces(0, 25, location, distance, true);

            return(result);
        }
Exemple #2
0
        public async Task <ActionResult <IEnumerable <Place> > > GetEstablishments(int page = 1, int pageSize = 25, bool mine = true, bool pendingReview = true)
        {
            var user = GetUserId();

            if (page < 1)
            {
                return(BadRequest());
            }
            var result = await _placesService.GetPlaces(page, pageSize, user, mine, pendingReview);

            return(Ok(result));
        }
Exemple #3
0
        public async Task <ActionResult> Init()
        {
            try
            {
                var dbPlaces = await _placesService.GetPlaces();

                List <Row> Rows = new List <Row>();
                for (int r = 1; r <= 40; r++)
                {
                    var _row = new Row {
                        RowNumber = r
                    };
                    for (int p = 1; p <= 20; p++)
                    {
                        var busy = dbPlaces.Where(w => w.PlaceNumber == p && w.Row == r).SingleOrDefault() != null ? true : false;
                        _row.Cols.Add(new Col {
                            PlaceNumber = p, Busy = busy
                        });
                    }
                    Rows.Add(_row);
                }
                return(Json(new
                {
                    Success = true,
                    Message = Rows
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    Success = false,
                    Message = ex.Message
                }, JsonRequestBehavior.AllowGet));
            }
        }
 public Place Get(int id)
 {
     return(_placeService.GetPlaces(id));
 }