Beispiel #1
0
        public LocationModel(RpgLocation _selectedLocation, List <RpgLocation> _containedLocations, List <Breadcrumb> _locationHierarchy, List <Character> _playerList)
        {
            // Keep detail about selected location
            // We want names and ID's for contained locations
            // LocationHierarchy breadcrumb object
            SelectedLocation = _selectedLocation;

            ContainedLocations = _containedLocations;

            LocationHierarchy = _locationHierarchy;

            PlayersAware = (from p in _playerList
                            select new SelectListItem()
            {
                Text = p.Name,
                Value = p.ID.ToString(),
                Selected = p.IsAware
            }).ToList();

            PlayersVisited = (from p in _playerList
                              select new SelectListItem()
            {
                Text = p.Name,
                Value = p.ID.ToString(),
                Selected = p.HasVisited
            }).ToList();
        }
Beispiel #2
0
        public DataResponse SaveHistory(int id, string content)
        {
            DataResponse response = new DataResponse();
            RpgLocation  location = context.RpgLocations.Where(x => x.ID == id).SingleOrDefault();

            location.History = content;
            try
            {
                context.Entry(location).CurrentValues.SetValues(location);
                context.SaveChanges();
            }
            catch (Exception ex)
            {
                response.Message = "Error updating";
            }
            return(response);
        }