public IHttpActionResult SaveDet()
        {
            int islno = 0;
            Dictionary <string, object> RetData = new Dictionary <string, object>();

            try
            {
                Dictionary <string, object> SearchData = new Dictionary <string, object>();
                var       model  = HttpContext.Current.Request.Form["record"];
                pim_spotd record = JsonConvert.DeserializeObject <pim_spotd>(model);
                using (SpotService obj = new SpotService())
                {
                    RetData = obj.SaveDet(record);
                    islno   = Lib.Conv2Integer(RetData["slno"].ToString());
                }
                System.Web.HttpFileCollection hfc = System.Web.HttpContext.Current.Request.Files;
                for (int iCnt = 0; iCnt <= hfc.Count - 1; iCnt++)
                {
                    Lib.UploadFile(hfc[iCnt], record._globalvariables.comp_code, record.spotd_pkid, hfc.Keys[iCnt]);
                }
                return(Ok(RetData));
            }
            catch (Exception Ex)
            {
                return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.BadRequest, Ex.Message.ToString())));
            }
        }
Esempio n. 2
0
 public PositionService(SpotService spotService, ITimerFactory timerFactory, DataGenerationSettings settings,
                        IHubContext <UpdateHub> updateHub)
 {
     _spotService = spotService;
     _settings    = settings;
     _updateHub   = updateHub;
     _timer       = timerFactory.Create(UpdatePositions);
 }
 public GameController(GameService gameService, SpotService spotService, RewardService rewardService, IntersectionGameSpotService intersectionGameSpotService, IntersectionGameRewardService intersectionGameRewardService)
 {
     GameService   = gameService;
     SpotService   = spotService;
     RewardService = rewardService;
     IntersectionGameSpotService   = intersectionGameSpotService;
     IntersectionGameRewardService = intersectionGameRewardService;
 }
        public IActionResult AddGame()
        {
            AddGameViewModel addGameViewModel = new AddGameViewModel
            {
                Spots   = SpotService.GetAllSpots(),
                Rewards = RewardService.GetAllRewards(),
            };

            return(View(addGameViewModel));
        }
 public IHttpActionResult GetRecord(Dictionary <string, object> SearchData)
 {
     try
     {
         using (SpotService obj = new SpotService())
             return(Ok(obj.GetRecord(SearchData)));
     }
     catch (Exception Ex)
     {
         return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.BadRequest, Ex.Message.ToString())));
     }
 }
Esempio n. 6
0
        public IHttpActionResult GetById(int id)
        {
            if (id <= 0)
            {
                return(NotFound());
            }

            var spotService = new SpotService();
            var spot        = spotService.GetById(id);

            return(Ok(spot));
        }
        public IActionResult Edit(Guid Id)
        {
            EditGameViewModel EditGameViewModel = new EditGameViewModel
            {
                Spots   = SpotService.GetAllSpots(),
                Rewards = RewardService.GetAllRewards(),
                IntersectionGameSpots   = IntersectionGameSpotService.GetAllIntersections(),
                IntersectionGameRewards = IntersectionGameRewardService.GetAllIntersections(),
                GameModel = GameService.GetGameFromGameId(Id)
            };

            return(View(EditGameViewModel));
        }
Esempio n. 8
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. 9
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. 10
0
        private void LinkGameToSpots(ICollection <string> formKeys, GameModel game)
        {
            List <Spot> allSpots = SpotService.GetAllSpots();

            foreach (string key in formKeys)
            {
                foreach (Spot spot in allSpots)
                {
                    if (spot.Id.ToString() == key)
                    {
                        IntersectionGameSpot intersectionGameSpot = new IntersectionGameSpot
                        {
                            GameId = game.Id,
                            SpotId = spot.Id
                        };
                        IntersectionGameSpotService.AddIntersection(intersectionGameSpot);
                    }
                }
            }
        }
Esempio n. 11
0
 public SpotController(SpotService service)
 {
     _service = service;
 }
Esempio n. 12
0
 public void SetUp()
 {
     _settings = new DataGenerationSettings();
     _service  = new SpotService(_settings);
 }
Esempio n. 13
0
 public SpotController(SpotService spotService)
 {
     SpotService = spotService;
 }
Esempio n. 14
0
 public async Task<List<SpotSearchResult>> Get(double longitude, double latitude)
 {
     SpotService service = new SpotService(_spotrepository, _spotsearchrepository);
     return await service.GetSpotsNearbyAsync(longitude, latitude);
 }
Esempio n. 15
0
 public async Task<List<SpotSearchResult>> Get(string searchName)
 {
     SpotService service = new SpotService(_spotrepository, _spotsearchrepository);
     return await service.GetSpotsByNameAsync(searchName);
 }