Esempio n. 1
0
        // POST: api/Checkin
        public void Post([FromBody]Models.CheckinJson checkin)
        {
            Mappers.MapSpot2Json mapper = new Mappers.MapSpot2Json();

            var service = new CheckinService(_checkinrepository, _spotSearchRepository);
            service.CreateNewCheckIn(new Checkin()
            {
                CheckinTime = checkin.CheckinTime,
                Description = checkin.Description,
                Location = mapper.MapJson2Location(checkin.Location),
            } );
        }
Esempio n. 2
0
        // POST: api/Spot
        public async Task Post([FromBody]Models.SpotJson spot)
        {
            Mappers.MapSpot2Json mapper = new Mappers.MapSpot2Json();

            SpotService service = new SpotService(_spotrepository, _spotsearchrepository);
            await service.CreateNewSpot(
                spot.Name, 
                spot.Description, 
                spot.Directions, 
                mapper.MapJson2Location(spot.Location), 
                mapper.MapJson2Conditions(spot.Conditions), 
                mapper.MapJson2Levels(spot.Levels)
            );
        }
Esempio n. 3
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
            };
        }
Esempio n. 4
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;

        }