예제 #1
0
        public Models.SpotJson Get(Guid id)
        {
            Mappers.MapSpot2Json mapper = new Mappers.MapSpot2Json();

            SpotService service = new SpotService(_spotrepository, _spotsearchrepository);
            Spot spot = service.GetSpotById(id.ToString());

            if (spot == null) throw new ArgumentException("Spot with id: {0} not found", id.ToString());

            return new Models.SpotJson()
            {
                Conditions = mapper.MapConditions2Json(spot.Conditions),
                Description = spot.Description,
                Directions = spot.Directions,
                Levels = mapper.MapLevels2Json(spot.Levels),
                Location = mapper.MapLocation2Json(spot.Location),
                Name = spot.Name,
                Uid = spot.Uid
            };
        }
예제 #2
0
        public IEnumerable<Models.CheckinJson> Get()
        {
            Mappers.MapSpot2Json mapper = new Mappers.MapSpot2Json();
            List<Models.CheckinJson> checkinListJson = new List<Models.CheckinJson>();

            var service = new CheckinService(_checkinrepository, _spotSearchRepository);
            List<Checkin> checkinList = service.GetAllCheckIn();

            foreach (var item in checkinList)
            {
                Models.CheckinJson checkinJson = new Models.CheckinJson()
                {
                    Uid = item.Uid,
                    CheckinTime = DateTime.Now,
                    Location = mapper.MapLocation2Json(item.Location),
                    Description = item.Description,                   
                };

                checkinListJson.Add(checkinJson);
            }

            return checkinListJson;

        }