Example #1
0
        public ResponseViewModel Delete(int id)
        {
            var response = new ResponseViewModel();

            var vehicleType = _vehicleTypeDal.GetVehicleType(p => p.Id == id);

            if (vehicleType == null)
            {
                response.IsSuccess = false;
                response.Message   = "vehicleType bulunamadı.";
                return(response);
            }

            vehicleType.IsDeleted = true;

            _vehicleTypeDal.Update(vehicleType);
            var saving = _vehicleTypeDal.SaveChanges();

            if (!saving)
            {
                response.IsSuccess = false;
                response.Message   = "vehicleType silme işlemi sırasında hata oluştu.";

                return(response);
            }

            response.Data = vehicleType;

            return(response);
        }
Example #2
0
        private bool IsVehicleTypeHave(int vehicleTypeId)
        {
            var vehicleType = _vehicleTypeDal.GetVehicleType(x => x.Id == vehicleTypeId);

            if (vehicleType == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #3
0
        private string GetVehicleTypeName(int vehicleId)
        {
            var vehicle = _vehicleDal.GetVehicle(p => p.Id == vehicleId);

            if (vehicle != null)
            {
                var vehicleType = _vehicleTypeDal.GetVehicleType(p => p.Id == vehicle.VehicleTypeId);
                return(vehicleType.Name);
            }
            else
            {
                return(null);
            }
        }