public IResult Add(Car car) { if (car.DailyPrice < 0 && car.CarName.Length < 3) { return(new ErrorResult(Messages.VehicleNameInvalid)); } _vehicleDal.Add(car); return(new SuccessResult(Messages.VehicleAdded)); }
public IResult Add(Vehicle vehicle) { IResult result = BusinessRules.Run(CheckIfTheSameVehicleCountExceeded(vehicle.VehicleName), CheckIfTheSameBrandCountExceeded());//Eklenecek her yeni kuralın aşağıda metodunu yazıp burda virgülle ayırıp çagırıyoruz if (result != null) { return(result); } _vehicleDal.Add(vehicle); return(new SuccessResult(Messages.VehicleAdded)); }
public void Add(Vehicle vehicle) { _vehicleDal.Add(vehicle); }
public ResponseViewModel Add(VehicleDto vehicleDto) { var response = new ResponseViewModel(); var vehicletypeId = IsVehicleTypeHave(vehicleDto.VehicleTypeId); if (!vehicletypeId) { response.IsSuccess = false; response.Message = "vehicletypeId VehicleType tablosunda bulunamadı"; return(response); } if (vehicleDto.UserId != null) { var userId = IsUserHave((int)vehicleDto.UserId); if (!userId) { response.IsSuccess = false; response.Message = "UserID User tablosunda bulunamadı"; return(response); } } if (vehicleDto.CreatedBy != null) { var createdBy = IsUserHave((int)vehicleDto.CreatedBy); if (!createdBy) { response.IsSuccess = false; response.Message = "createdBy User tablosunda bulunamadı"; return(response); } } if (vehicleDto.ModifiedBy != null) { var modifiedBy = IsUserHave((int)vehicleDto.ModifiedBy); if (!modifiedBy) { response.IsSuccess = false; response.Message = "ModifiedBy User tablosunda bulunamadı"; return(response); } } var vehicle = new Vehicle() { PlateNo = vehicleDto.PlateNo, VehicleTypeId = vehicleDto.VehicleTypeId, UserId = vehicleDto.UserId, CreateDate = DateTime.Now, CreatedBy = vehicleDto.CreatedBy, ModifyDate = vehicleDto.ModifyDate, ModifiedBy = vehicleDto.ModifiedBy }; _vehicleDal.Add(vehicle); var saving = _vehicleDal.SaveChanges(); if (!saving) { response.IsSuccess = false; response.Message = "Vehicle ekleme işlemi sırasında hata oluştu."; return(response); } response.Data = "Id : " + vehicle.Id; return(response); }
public IResult Add(Vehicle vehicle) { _vehicleDal.Add(vehicle); return(new SuccessResult(Messages.Added)); }
public void Add(Vehicle product) { _productDal.Add(product); }
public IResult Add(Vehicle car) { _vehicleDal.Add(car); return(new SuccessResult(Messages.CarAdded)); }