Ejemplo n.º 1
0
        public async Task <bool> CreateVehicle(VehicleMake vehicleMake)
        {
            if (!ValidateVehicleMake(vehicleMake))
            {
                return(false);
            }
            bool res = await _vehicleRepository.CreateVehicle(vehicleMake);

            return(res);
        }
Ejemplo n.º 2
0
 protected bool ValidateVehicleMake(VehicleMake vehicleMake)
 {
     if (vehicleMake.Name == null)
     {
         _validationDictionary.AddError("Name", "Name is required.");
     }
     if (vehicleMake.Abrv == null)
     {
         _validationDictionary.AddError("Abrv", "Abrv is required.");
     }
     return(_validationDictionary.IsValid);
 }
Ejemplo n.º 3
0
        public async Task <bool> DeleteVehicle(VehicleMake vehicleMake)
        {
            try
            {
                _entities.VehicleMakes.Remove(vehicleMake);
                await _entities.SaveChangesAsync();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        public async Task <bool> DeleteVehicle(VehicleMake vehicleMake)
        {
            bool res = await _vehicleRepository.DeleteVehicle(vehicleMake);

            return(res);
        }