public ActionResult Edit(int Id = 0)
        {
            var systemType = context.SystemTypes.FirstOrDefault(x => x.Id == Id);

            if (systemType == null)
            {
                TempData["Error"] = "Invalid Id";
                return(RedirectToAction("Index"));
            }

            var systemModel = new SystemCreateModel {
                Id = systemType.Id, Name = systemType.Name, IsActive = systemType.IsActive
            };

            foreach (var p in systemType.Parameters)
            {
                var newParameter = new ParameterModel
                {
                    Id              = p.Id,
                    Name            = p.Name,
                    Frequency       = p.Frequency,
                    ParameterTypeId = p.Type.Id,
                    Unit            = p.Unit,
                    Source          = p.Source,
                    Link            = p.Link,
                    Use             = p.Use
                };

                foreach (var b in p.ParameterBounds)
                {
                    var newBound = new BoundModel
                    {
                        Id             = b.Id,
                        Range          = b.Range,
                        MinValue       = b.MinValue,
                        MaxValue       = b.MaxValue,
                        MinDescription = b.MinDescription,
                        MaxDescription = b.MaxDescription,
                        IsEnforced     = b.IsEnforced,
                        Type           = b.Type
//                        SiteId = b.Site == null ? 0 : b.Site.Id
                    };
                    newParameter.Bounds.Add(newBound);
                }

                systemModel.Parameters.Add(newParameter);
            }

            ViewBag.ParameterTypes = context.ParameterTypes.Select(x => new { Id = x.Id, Name = x.Name });
            ViewBag.Sites          = context.Sites.Select(x => new { Id = x.Id, Name = x.Name });
            ViewBag.Data           = systemModel;

            return(View());
        }
    public RepairsViewModel()
    {
        //We need to do a clout check as well as a network checks
        int baseModifier = Mathf.CeilToInt(2 - GameVars.GetOverallCloutModifier(GameVars.currentSettlement.settlementID));

        if (GameVars.Network.CheckIfCityIDIsPartOfNetwork(GameVars.currentSettlement.settlementID))
        {
            costToRepair = Mathf.CeilToInt(GameVars.currentSettlement.tax_network * baseModifier * 1);
        }
        else
        {
            costToRepair = Mathf.CeilToInt(GameVars.currentSettlement.tax_neutral * baseModifier * 1);
        }

        shipHealth = new BoundModel <float>(GameVars.playerShipVariables.ship, nameof(GameVars.playerShipVariables.ship.health));
        shipLevel  = new BoundModel <int>(GameVars.playerShipVariables.ship, nameof(GameVars.playerShipVariables.ship.upgradeLevel));
    }
    public DashboardViewModel()
    {
        Clout = new BoundModel <float>(Globals.GameVars.playerShipVariables.ship, nameof(Globals.GameVars.playerShipVariables.ship.playerClout));

        var water = GameVars.playerShipVariables.ship.cargo.FirstOrDefault(r => r.name == Resource.Water);

        WaterInventory = new CargoInventoryViewModel(water);

        var food = GameVars.playerShipVariables.ship.cargo.FirstOrDefault(r => r.name == Resource.Provisions);

        FoodInventory = new CargoInventoryViewModel(food);

        CargoList = ValueModel.Wrap(new ObservableCollection <CargoInventoryViewModel>(GameVars.playerShipVariables.ship.cargo.Select(c => new CargoInventoryViewModel(c))));

        CrewList = ValueModel.Wrap(GameVars.playerShipVariables.ship.crewRoster)
                   .Select(c => new CrewManagementMemberViewModel(c, OnCrewClicked, OnCrewCityClicked));

        SailsAreUnfurled = new BoundModel <bool>(GameVars.playerShipVariables.ship, nameof(GameVars.playerShipVariables.ship.sailsAreUnfurled));

        Objective = new BoundModel <string>(GameVars.playerShipVariables.ship, nameof(GameVars.playerShipVariables.ship.objective));
    }