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(); }
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); }