示例#1
0
        public async Task <bool> Update(VehicleModel model)
        {
            var validator = new VehicleModelValidator();

            if (!validator.Validate(model).IsValid)
            {
                throw new TaskSchedulerException();
            }

            return(await this.vehicleRepository.UpdateIntoDatabase(this.mapper.Map <VehicleModel, Vehicle>(model)));
        }
示例#2
0
        public async Task <bool> Create(VehicleModel model)
        {
            var validator = new VehicleModelValidator().Validate(model);

            if (!validator.IsValid)
            {
                var error = validator.Errors;
                throw new TaskSchedulerException();
            }

            return(await this.vehicleRepository.InsertIntoDatabase(this.mapper.Map <VehicleModel, Vehicle>(model)));
        }