Ejemplo n.º 1
0
        public Task <bool> AddNewVehicleToGame(GTAVehiclesRanked newVehicle)
        {
            Gtavehicles objGTAVehicle = new Gtavehicles()
            {
                VehicleModel = newVehicle.VehicleModel,
                ClassId      = newVehicle.ClassId,
                TrackSpeed   = newVehicle.TrackSpeed,
                DragSpeed    = newVehicle.DragSpeed
            };

            _context.Gtavehicles.Add(objGTAVehicle);
            _context.SaveChanges();

            return(Task.FromResult(true));
        }
Ejemplo n.º 2
0
        public Task <bool> EditVehicleInGame(GTAVehiclesRanked ExistingVehicle)
        {
            var GtaVehicle =
                _context.Gtavehicles
                .Where(x => x.Id == ExistingVehicle.Id)
                .FirstOrDefault();

            if (GtaVehicle != null)
            {
                GtaVehicle.ClassId      = ExistingVehicle.ClassId;
                GtaVehicle.DragSpeed    = ExistingVehicle.DragSpeed;
                GtaVehicle.TrackSpeed   = ExistingVehicle.TrackSpeed;
                GtaVehicle.VehicleModel = ExistingVehicle.VehicleModel;

                _context.SaveChanges();
            }
            else
            {
                return(Task.FromResult(false));
            }

            return(Task.FromResult(true));
        }