コード例 #1
0
        public IHttpActionResult Post(CarStyle style)
        {
            _context.CarStyles.Add(style);
            _context.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = style.Id }, style));
        }
コード例 #2
0
 public SmartInsurance(CarStyle carType, string driverName, int averageSpeed, bool doesTailgate, bool stopOrRoll, bool swerve, decimal premiumCost, decimal tailgateCost, decimal stopCost, decimal swerveCost, decimal speedingCost)
 {
     CarType      = carType;
     DriverName   = driverName;
     AverageSpeed = averageSpeed;
     DoesTailgate = doesTailgate;
     StopOrRoll   = stopOrRoll;
     Swerve       = swerve;
     PremiumCost  = premiumCost;
     TailgateCost = tailgateCost;
     StopCost     = stopCost;
     SwerveCost   = swerveCost;
     SpeedingCost = speedingCost;
 }
コード例 #3
0
    public CarData FindCarData(CarStyle style)
    {
        if (style == CarStyle.Any)
        {
            style = (CarStyle)UnityEngine.Random.Range(0, 5);
        }
        string lookup = style.ToString();

        if (_dataLookup.ContainsKey(lookup))
        {
            return(_dataLookup[lookup]);
        }
        return(null);
    }