void updateTourListOnAdd(string name)
    {
        GameObject       newSchedule = Instantiate(ListItemPrefab) as GameObject;
        LocationListItem controller  = newSchedule.GetComponent <LocationListItem>();

        controller.Name.text             = name;
        newSchedule.transform.parent     = ContentPanel.transform;
        newSchedule.transform.localScale = Vector3.one;
    }
Beispiel #2
0
    void createTourList()
    {
        foreach (string s in tours)
        {
            GameObject newSchedule = Instantiate(ListItemPrefab) as GameObject;

            LocationListItem controller = newSchedule.GetComponent <LocationListItem>();
            controller.Name.text = s;

            newSchedule.transform.parent     = ContentPanel.transform;
            newSchedule.transform.localScale = Vector3.one;
        }
        toursDisplayed = true;
    }
        // GET: Location
        public ActionResult Index(LocationListItem name, string search)
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new LocationService(userId);
            var model   = service.GetLocations();

            if (search != null)
            {
                return(View(model.Where(x => x.TaggingLocation.StartsWith(search, StringComparison.OrdinalIgnoreCase) || search == null).ToList()));
            }
            else
            {
                return(View(model));
            }
        }
        public IHttpActionResult Put(LocationListItem model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = CreateLocationService();

            if (!service.UpdateLocation(model))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
Beispiel #5
0
 public bool UpdateLocation(LocationListItem model)
 {
     using (var ctx = new ApplicationDbContext())
     {
         var entity =
             ctx
             .Locations
             .Single(e => e.Id == model.Id);
         entity.MetroArea = model.MetroArea;
         entity.Name      = model.Name;
         entity.Country   = model.Country;
         entity.HistoryId = model.HistoryId;
         entity.GameId    = model.GameId;
         return(ctx.SaveChanges() == 1);
     }
 }
    void createTourListFromDictionary()
    {
        singleton = Singleton.Instance();
        string currentTourName = singleton.getTourName();

        PSLocationArraySingleton       s = PSLocationArraySingleton.Instance();
        Dictionary <string, ArrayList> toursLocations = s.getToursLocationDictionary();

        locations = toursLocations[currentTourName];

        foreach (string location in locations)
        {
            GameObject newSchedule = Instantiate(ListItemPrefab) as GameObject;

            LocationListItem controller = newSchedule.GetComponent <LocationListItem>();
            controller.Name.text = location;

            newSchedule.transform.parent     = ContentPanel.transform;
            newSchedule.transform.localScale = Vector3.one;
        }
        locationsDisplayed = true;
    }
Beispiel #7
0
        public List <LocationListItem> GetLocationsByCharacterId(int gameId)
        {
            List <LocationListItem> result = new List <LocationListItem>();

            using (var ctx = new ApplicationDbContext())
            {
                var query =
                    ctx.Characters
                    .Single(e => e.CharacterId == gameId);
                foreach (Location l in query.ListOfLocations)
                {
                    LocationListItem e = new LocationListItem();
                    e.Country   = l.Country;
                    e.GameId    = l.GameId;
                    e.HistoryId = l.HistoryId;
                    e.Id        = l.Id;
                    e.MetroArea = l.MetroArea;
                    e.Name      = l.Name;

                    result.Add(e);
                }
                return(result);
            }
        }